statsd_test_harness 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2745ed62d8025865b2196dc433fe01c3685217db
4
- data.tar.gz: 5f57dad08afb4291b864a106f6c21b81210e71ba
3
+ metadata.gz: 73dacd0855209fa103cc8b6f903f492499c4ad5e
4
+ data.tar.gz: 2e0effb947f34cb826b4401d5ace4455abd4e0a8
5
5
  SHA512:
6
- metadata.gz: 683387ff1a54880806e8289556ed858952a6f6ebc6902dffb882835a2c3aa505abfb7ead0da015847cbbcd9dbce2a347bf563c695d8be636697dbfb8783b273d
7
- data.tar.gz: 061edae79e01c9f60feadfd8e0183da621dc692e3d2e6b418fa1b4e6bd0eb0646065f593ca1ffeb4bc409686eec5abf0a0c57cfd77774974aa42b5d361071c4e
6
+ metadata.gz: 753abe1ebeadc367bbafeec17cadf7ced7ae7c2e6ed7756f628eb64060a33f16bd8e34f1b1cff9a065d05fd8def9f41e8cdb45dfec28daf68e617f3cd0391a43
7
+ data.tar.gz: d2bb240f6e9c1670fcd666e52d19c05d21ff2f1c19b75c77c1ad0f61b2da6cd4c3c7e7f8b384a555e1afccfdca6a138e88014df02449e44a55118545578afe10
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- statsd_test_harness (0.2.4)
4
+ statsd_test_harness (0.2.5)
5
5
  dotenv (~> 2.0)
6
6
  require_all (~> 1.3)
7
7
  statsd-ruby (~> 0.3.0)
data/README.md CHANGED
@@ -42,10 +42,10 @@ To register a new test framework, add it to the `config.tools` array in your con
42
42
  command: 'test',
43
43
  label: 'my_framework',
44
44
  options: '',
45
- ignore_return_value: true
45
+ ignore_return_value: false
46
46
  }
47
47
 
48
- Set the `ignore_return_value` flag to false if you don't want to report an unsuccessful test run (based on exit status).
48
+ Set the `ignore_return_value` flag to true if you don't want to report an unsuccessful test run (based on exit status).
49
49
 
50
50
  ## Development
51
51
 
@@ -12,7 +12,7 @@ StatsdTestHarness.configure do |config|
12
12
  name: 'rspec',
13
13
  command: 'rspec',
14
14
  options: 'spec/models/conversation_spec.rb',
15
- ignore_return_value: true
15
+ ignore_return_value: false
16
16
  }
17
17
  ]
18
18
 
@@ -1,19 +1,23 @@
1
1
  module StatsdTestHarness
2
2
  class Client
3
3
 
4
- def post(duration, label)
5
- puts "Sending test data from #{label} suite for app #{StatsdTestHarness.config.app_name}..."
6
- client.timing(
7
- "#{StatsdTestHarness.config.namespace}.#{StatsdTestHarness.config.app_name}.#{label}.duration",
8
- duration
9
- )
4
+ def post(duration, label, successful, send_failures=true)
5
+ type = successful ? "success" : "fail"
6
+ if successful || send_failures
7
+ puts "Sending '#{type}' test data from #{label} suite for app #{StatsdTestHarness.config.app_name}..."
8
+ client.timing("#{bucket}.#{label}.#{type}", duration)
9
+ end
10
10
  end
11
11
 
12
12
  private
13
13
 
14
+ def bucket
15
+ "#{StatsdTestHarness.config.namespace}.#{StatsdTestHarness.config.app_name}"
16
+ end
17
+
14
18
  def client
15
19
  Statsd.new(StatsdTestHarness.config.host, StatsdTestHarness.config.port)
16
20
  end
17
21
 
18
22
  end
19
- end
23
+ end
@@ -14,9 +14,13 @@ module StatsdTestHarness
14
14
  StatsdTestHarness.config.tools.each do |tool_harness|
15
15
  tool = Tool.new(tool_harness)
16
16
  puts "Executing #{tool.name} test suite for #{StatsdTestHarness.config.app_name}..."
17
- duration = with_timing{tool.run}
18
- StatsdTestHarness::Client.new.post(duration, tool.name)
17
+ exit_status, duration = with_timing{tool.run}
18
+ success = exit_status.to_i == 0
19
+ StatsdTestHarness::Client.new.post(duration, tool.name, success, !tool.ignore_return_value)
19
20
  puts "Test suite for #{tool.name} completed in #{duration} ms."
21
+ unless success || tool.ignore_return_value
22
+ exit exit_status
23
+ end
20
24
  end
21
25
  end
22
26
 
@@ -29,7 +33,7 @@ module StatsdTestHarness
29
33
  validate_env_variables
30
34
  rescue Exception => e
31
35
  puts "-- Invalid configuration, exiting: #{e}"
32
- exit 1
36
+ exit
33
37
  end
34
38
  end
35
39
 
@@ -47,8 +51,8 @@ module StatsdTestHarness
47
51
 
48
52
  def with_timing
49
53
  start_time = Time.now.to_f
50
- yield
51
- (Time.now.to_f - start_time) * 1000
54
+ exit_status = yield
55
+ [exit_status, (Time.now.to_f - start_time) * 1000]
52
56
  end
53
57
 
54
58
  end
@@ -15,12 +15,12 @@ module StatsdTestHarness
15
15
  cmd = open("| #{self.command} #{self.options}")
16
16
  cmd.each_line{ |io| print io }
17
17
  cmd.close
18
+ exit_status
19
+ end
18
20
 
19
- if $?.to_i > 0 && ! ignore_return_value
20
- raise "Test run returned non-zero status, results not submitted."
21
- end
22
- true
21
+ def exit_status
22
+ $?.exitstatus
23
23
  end
24
24
 
25
25
  end
26
- end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module StatsdTestHarness
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statsd_test_harness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - CoralineAda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-14 00:00:00.000000000 Z
11
+ date: 2015-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor