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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/config/sample_config.rb +1 -1
- data/lib/statsd_test_harness/client.rb +11 -7
- data/lib/statsd_test_harness/processor.rb +9 -5
- data/lib/statsd_test_harness/tool.rb +5 -5
- data/lib/statsd_test_harness/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73dacd0855209fa103cc8b6f903f492499c4ad5e
|
4
|
+
data.tar.gz: 2e0effb947f34cb826b4401d5ace4455abd4e0a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 753abe1ebeadc367bbafeec17cadf7ced7ae7c2e6ed7756f628eb64060a33f16bd8e34f1b1cff9a065d05fd8def9f41e8cdb45dfec28daf68e617f3cd0391a43
|
7
|
+
data.tar.gz: d2bb240f6e9c1670fcd666e52d19c05d21ff2f1c19b75c77c1ad0f61b2da6cd4c3c7e7f8b384a555e1afccfdca6a138e88014df02449e44a55118545578afe10
|
data/Gemfile.lock
CHANGED
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:
|
45
|
+
ignore_return_value: false
|
46
46
|
}
|
47
47
|
|
48
|
-
Set the `ignore_return_value` flag to
|
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
|
|
data/config/sample_config.rb
CHANGED
@@ -1,19 +1,23 @@
|
|
1
1
|
module StatsdTestHarness
|
2
2
|
class Client
|
3
3
|
|
4
|
-
def post(duration, label)
|
5
|
-
|
6
|
-
|
7
|
-
"#{
|
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
|
-
|
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
|
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
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
true
|
21
|
+
def exit_status
|
22
|
+
$?.exitstatus
|
23
23
|
end
|
24
24
|
|
25
25
|
end
|
26
|
-
end
|
26
|
+
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
|
+
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-
|
11
|
+
date: 2015-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|