statsd_test_harness 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -6
- data/config/{config.rb → sample_config.rb} +3 -3
- data/lib/statsd_test_harness.rb +1 -1
- data/lib/statsd_test_harness/processor.rb +19 -5
- data/lib/statsd_test_harness/version.rb +1 -1
- metadata +2 -3
- data/config/canvas_config.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb076d5a472dc9b47e680b5d800f69d0bf9d2068
|
4
|
+
data.tar.gz: 01d1a1b26c113be200a12198c86e2ea4342438bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e35b0f593d8bd4b4561b5358ac326f42000109da1a64b13f39d34e1c42058f476eca62321f94f9405def9914c2f8a7381a073d5819fd4a1ad926d992276d7c8c
|
7
|
+
data.tar.gz: 59cc9da579d16e4515a0872850e20e4bb74f28d0990f48629584ffea1de5128377428288c4d43449d4fb8180bfe19de8c7c84dd16751b0994bedfc6e417394f3
|
data/README.md
CHANGED
@@ -24,18 +24,16 @@ Set the following environment variables for statsd integration:
|
|
24
24
|
|
25
25
|
STATSD_HOST=192.168.42.10
|
26
26
|
STATSD_PORT=2003
|
27
|
-
|
27
|
+
STATSD_APP_NAME=my_app_name
|
28
28
|
|
29
29
|
## Usage
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
wrap run_suite
|
34
|
-
|
35
|
-
If you don't have a configuration in config/config.rb, you can specify a config file at runtime:
|
31
|
+
You must specify a config file at runtime:
|
36
32
|
|
37
33
|
wrap run_suite --config path/to/config/file.rb
|
38
34
|
|
35
|
+
For an example of what the config file should look like, refer to config/sample_config.rb
|
36
|
+
|
39
37
|
## Development
|
40
38
|
|
41
39
|
To add support for a new test suite, create a file in statsd_test_harness/postprocessors/ that will extract the duration output
|
@@ -2,9 +2,9 @@ require 'dotenv'
|
|
2
2
|
Dotenv.load
|
3
3
|
|
4
4
|
StatsdTestHarness.configure do |config|
|
5
|
-
config.statsd_host
|
6
|
-
config.statsd_port
|
7
|
-
config.
|
5
|
+
config.statsd_host = ENV['STATSD_HOST']
|
6
|
+
config.statsd_port = ENV['STATSD_PORT']
|
7
|
+
config.statsd_app_name = ENV['STATSD_APP_NAME']
|
8
8
|
|
9
9
|
config.tools = [
|
10
10
|
{
|
data/lib/statsd_test_harness.rb
CHANGED
@@ -6,7 +6,7 @@ module StatsdTestHarness
|
|
6
6
|
|
7
7
|
attr_reader :path_to_config
|
8
8
|
|
9
|
-
def initialize(path_to_config
|
9
|
+
def initialize(path_to_config)
|
10
10
|
@path_to_config = path_to_config
|
11
11
|
end
|
12
12
|
|
@@ -25,18 +25,19 @@ module StatsdTestHarness
|
|
25
25
|
private
|
26
26
|
|
27
27
|
def load_external_config
|
28
|
-
return if self.path_to_config.empty?
|
29
28
|
begin
|
30
29
|
load self.path_to_config
|
30
|
+
validate_path_to_config
|
31
|
+
validate_env_variables
|
31
32
|
rescue Exception => e
|
32
|
-
puts "-- Unable to read
|
33
|
+
puts "-- Unable to read config file: #{e}"
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
36
37
|
def post_to_statsd(data, label)
|
37
|
-
puts "Sending test data from #{label} suite for app #{StatsdTestHarness.config.
|
38
|
+
puts "Sending test data from #{label} suite for app #{StatsdTestHarness.config.statsd_app_name}..."
|
38
39
|
GraphiteAPI.new(graphite: endpoint).metrics(
|
39
|
-
{"stats.timers.#{StatsdTestHarness.config.
|
40
|
+
{"stats.timers.#{StatsdTestHarness.config.statsd_app_name}.#{label}.duration" => data.duration},
|
40
41
|
Time.now
|
41
42
|
)
|
42
43
|
end
|
@@ -45,6 +46,19 @@ module StatsdTestHarness
|
|
45
46
|
"http://#{StatsdTestHarness.config.statsd_host}:#{StatsdTestHarness.config.statsd_port}"
|
46
47
|
end
|
47
48
|
|
49
|
+
def validate_path_to_config
|
50
|
+
if self.path_to_config.empty?
|
51
|
+
puts "No config file specified, exiting"
|
52
|
+
exit
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def validate_env_variables
|
57
|
+
unless StatsdTestHarness.config.statsd_host && StatsdTestHarness.config.statsd_port
|
58
|
+
puts "No statsd environment variables defined, exiting"
|
59
|
+
exit
|
60
|
+
end
|
61
|
+
end
|
48
62
|
end
|
49
63
|
|
50
64
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statsd_test_harness
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CoralineAda
|
@@ -127,8 +127,7 @@ files:
|
|
127
127
|
- bin/console
|
128
128
|
- bin/setup
|
129
129
|
- bin/wrap
|
130
|
-
- config/
|
131
|
-
- config/config.rb
|
130
|
+
- config/sample_config.rb
|
132
131
|
- lib/statsd_test_harness.rb
|
133
132
|
- lib/statsd_test_harness/cli.rb
|
134
133
|
- lib/statsd_test_harness/postprocessors/rspec.rb
|
data/config/canvas_config.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'dotenv'
|
2
|
-
Dotenv.load
|
3
|
-
|
4
|
-
StatsdTestHarness.configure do |config|
|
5
|
-
config.statsd_host = ENV['STATSD_HOST']
|
6
|
-
config.statsd_port = ENV['STATSD_PORT']
|
7
|
-
config.app_name = "canvas-lms"
|
8
|
-
|
9
|
-
config.tools = [
|
10
|
-
{
|
11
|
-
name: 'rspec',
|
12
|
-
command: 'rspec',
|
13
|
-
label: 'rspec',
|
14
|
-
options: './spec/selenium/wiki_pages_spec.rb',
|
15
|
-
ignore_return_value: true,
|
16
|
-
postprocessor: StatsdTestHarness::Postprocessors::RSpec
|
17
|
-
}
|
18
|
-
]
|
19
|
-
|
20
|
-
end
|