sensu-settings 9.1.1 → 9.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/sensu-settings.gemspec +2 -2
- metadata +3 -35
- data/.gitignore +0 -22
- data/.travis.yml +0 -15
- data/Gemfile +0 -4
- data/Rakefile +0 -6
- data/spec/assets/alternative/conf.d/loop +0 -1
- data/spec/assets/alternative/conf.d/symlinked.json +0 -11
- data/spec/assets/app/config/sensu/app_http_endpoint.json +0 -9
- data/spec/assets/bom.json +0 -7
- data/spec/assets/conf.d/alternative +0 -1
- data/spec/assets/conf.d/merger.json +0 -11
- data/spec/assets/conf.d/nested/file.json +0 -11
- data/spec/assets/config.json +0 -126
- data/spec/assets/invalid.json +0 -2
- data/spec/helpers.rb +0 -8
- data/spec/loader_spec.rb +0 -243
- data/spec/rules_spec.rb +0 -66
- data/spec/settings_spec.rb +0 -67
- data/spec/validator_spec.rb +0 -942
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abf1a2331279c4c3f0359d9616cae1507f543a39
|
4
|
+
data.tar.gz: bc27754d38ea174528c251d9ff15557ae6898020
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a185d29af80da7d3e325a46902df2fcad06464d02c5bab6b6f2cdf484d4b8b8b4d2593f6e4e65f877f994ee3ca7a09020a9adba12c12e7e75524b471b0e1e09
|
7
|
+
data.tar.gz: e9ffe6d03e428179c736514b1fba3f26d5465ba69e7cdff53d480ee5e4cb98a207d7f3b5d4b8a887e9447dba0e846755e353a94ca17f53547a08985d40bf0d86
|
data/sensu-settings.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "sensu-settings"
|
5
|
-
spec.version = "9.1.
|
5
|
+
spec.version = "9.1.2"
|
6
6
|
spec.authors = ["Sean Porter"]
|
7
7
|
spec.email = ["portertech@gmail.com"]
|
8
8
|
spec.summary = "The Sensu settings library, loader and validator"
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.homepage = "https://github.com/sensu/sensu-settings"
|
11
11
|
spec.license = "MIT"
|
12
12
|
|
13
|
-
spec.files =
|
13
|
+
spec.files = Dir.glob("lib/**/*") + %w[sensu-settings.gemspec README.md LICENSE.txt]
|
14
14
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
15
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
16
|
spec.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.1.
|
4
|
+
version: 9.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Porter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-json
|
@@ -87,12 +87,8 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- ".gitignore"
|
91
|
-
- ".travis.yml"
|
92
|
-
- Gemfile
|
93
90
|
- LICENSE.txt
|
94
91
|
- README.md
|
95
|
-
- Rakefile
|
96
92
|
- lib/sensu/settings.rb
|
97
93
|
- lib/sensu/settings/constants.rb
|
98
94
|
- lib/sensu/settings/loader.rb
|
@@ -110,20 +106,6 @@ files:
|
|
110
106
|
- lib/sensu/settings/validators/time_window.rb
|
111
107
|
- lib/sensu/settings/validators/transport.rb
|
112
108
|
- sensu-settings.gemspec
|
113
|
-
- spec/assets/alternative/conf.d/loop
|
114
|
-
- spec/assets/alternative/conf.d/symlinked.json
|
115
|
-
- spec/assets/app/config/sensu/app_http_endpoint.json
|
116
|
-
- spec/assets/bom.json
|
117
|
-
- spec/assets/conf.d/alternative
|
118
|
-
- spec/assets/conf.d/merger.json
|
119
|
-
- spec/assets/conf.d/nested/file.json
|
120
|
-
- spec/assets/config.json
|
121
|
-
- spec/assets/invalid.json
|
122
|
-
- spec/helpers.rb
|
123
|
-
- spec/loader_spec.rb
|
124
|
-
- spec/rules_spec.rb
|
125
|
-
- spec/settings_spec.rb
|
126
|
-
- spec/validator_spec.rb
|
127
109
|
homepage: https://github.com/sensu/sensu-settings
|
128
110
|
licenses:
|
129
111
|
- MIT
|
@@ -148,18 +130,4 @@ rubygems_version: 2.6.3
|
|
148
130
|
signing_key:
|
149
131
|
specification_version: 4
|
150
132
|
summary: The Sensu settings library, loader and validator
|
151
|
-
test_files:
|
152
|
-
- spec/assets/alternative/conf.d/loop
|
153
|
-
- spec/assets/alternative/conf.d/symlinked.json
|
154
|
-
- spec/assets/app/config/sensu/app_http_endpoint.json
|
155
|
-
- spec/assets/bom.json
|
156
|
-
- spec/assets/conf.d/alternative
|
157
|
-
- spec/assets/conf.d/merger.json
|
158
|
-
- spec/assets/conf.d/nested/file.json
|
159
|
-
- spec/assets/config.json
|
160
|
-
- spec/assets/invalid.json
|
161
|
-
- spec/helpers.rb
|
162
|
-
- spec/loader_spec.rb
|
163
|
-
- spec/rules_spec.rb
|
164
|
-
- spec/settings_spec.rb
|
165
|
-
- spec/validator_spec.rb
|
133
|
+
test_files: []
|
data/.gitignore
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
*.bundle
|
19
|
-
*.so
|
20
|
-
*.o
|
21
|
-
*.a
|
22
|
-
mkmf.log
|
data/.travis.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
rvm:
|
4
|
-
- 2.0.0
|
5
|
-
- 2.1.0
|
6
|
-
- 2.2.0
|
7
|
-
- 2.2.3
|
8
|
-
- 2.3.0
|
9
|
-
- jruby-9.0.5.0
|
10
|
-
notifications:
|
11
|
-
irc:
|
12
|
-
- "irc.freenode.net#sensu"
|
13
|
-
addons:
|
14
|
-
code_climate:
|
15
|
-
repo_token: 824f4a75343a9300704f23e93eaaecb25d998e408f2c9b96cd44f55983d95483
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
../conf.d
|
data/spec/assets/bom.json
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
../alternative/conf.d/
|
data/spec/assets/config.json
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"api": {
|
3
|
-
"host": "localhost",
|
4
|
-
"port": 4567,
|
5
|
-
"user": "foo",
|
6
|
-
"password": "bar"
|
7
|
-
},
|
8
|
-
"filters": {
|
9
|
-
"production": {
|
10
|
-
"attributes": {
|
11
|
-
"client": {
|
12
|
-
"environment": "production"
|
13
|
-
}
|
14
|
-
}
|
15
|
-
},
|
16
|
-
"development": {
|
17
|
-
"negate": true,
|
18
|
-
"attributes": {
|
19
|
-
"client": {
|
20
|
-
"environment": "production"
|
21
|
-
}
|
22
|
-
}
|
23
|
-
}
|
24
|
-
},
|
25
|
-
"mutators": {
|
26
|
-
"noop": {
|
27
|
-
"command": "cat"
|
28
|
-
}
|
29
|
-
},
|
30
|
-
"handlers": {
|
31
|
-
"default": {
|
32
|
-
"type": "set",
|
33
|
-
"handlers": [
|
34
|
-
"debug"
|
35
|
-
]
|
36
|
-
},
|
37
|
-
"file": {
|
38
|
-
"type": "pipe",
|
39
|
-
"command": "cat > /tmp/sensu_event"
|
40
|
-
},
|
41
|
-
"filtered": {
|
42
|
-
"type": "pipe",
|
43
|
-
"command": "cat > /tmp/sensu_event",
|
44
|
-
"filter": "development"
|
45
|
-
},
|
46
|
-
"severities": {
|
47
|
-
"type": "pipe",
|
48
|
-
"command": "cat > /tmp/sensu_event",
|
49
|
-
"severities": [
|
50
|
-
"critical",
|
51
|
-
"unknown"
|
52
|
-
]
|
53
|
-
},
|
54
|
-
"flapping": {
|
55
|
-
"type": "pipe",
|
56
|
-
"command": "cat > /tmp/sensu_event",
|
57
|
-
"handle_flapping": true
|
58
|
-
},
|
59
|
-
"tcp": {
|
60
|
-
"type": "tcp",
|
61
|
-
"socket": {
|
62
|
-
"host": "localhost",
|
63
|
-
"port": 1234
|
64
|
-
}
|
65
|
-
},
|
66
|
-
"udp": {
|
67
|
-
"type": "udp",
|
68
|
-
"socket": {
|
69
|
-
"host": "localhost",
|
70
|
-
"port": 1234
|
71
|
-
}
|
72
|
-
},
|
73
|
-
"transport": {
|
74
|
-
"type": "transport",
|
75
|
-
"pipe": {
|
76
|
-
"type": "direct",
|
77
|
-
"name": "events"
|
78
|
-
}
|
79
|
-
}
|
80
|
-
},
|
81
|
-
"checks": {
|
82
|
-
"tokens": {
|
83
|
-
"command": "echo -n :::name::: :::nested.attribute::: && exit 2",
|
84
|
-
"subscribers": [
|
85
|
-
"test"
|
86
|
-
],
|
87
|
-
"interval": 1
|
88
|
-
},
|
89
|
-
"standalone": {
|
90
|
-
"command": "echo -n foobar && exit 1",
|
91
|
-
"standalone": true,
|
92
|
-
"interval": 1
|
93
|
-
},
|
94
|
-
"merger": {
|
95
|
-
"command": "this will be overwritten",
|
96
|
-
"subscribers": [
|
97
|
-
"foo"
|
98
|
-
]
|
99
|
-
},
|
100
|
-
"unpublished": {
|
101
|
-
"command": "/bin/true",
|
102
|
-
"publish": false,
|
103
|
-
"subscribers":[
|
104
|
-
"test"
|
105
|
-
]
|
106
|
-
}
|
107
|
-
},
|
108
|
-
"client": {
|
109
|
-
"name": "i-424242",
|
110
|
-
"address": "127.0.0.1",
|
111
|
-
"subscriptions": [
|
112
|
-
"test"
|
113
|
-
],
|
114
|
-
"nested": {
|
115
|
-
"attribute": true
|
116
|
-
},
|
117
|
-
"service": {
|
118
|
-
"password": "secret"
|
119
|
-
},
|
120
|
-
"keepalive": {
|
121
|
-
"thresholds": {
|
122
|
-
"warning": 10
|
123
|
-
}
|
124
|
-
}
|
125
|
-
}
|
126
|
-
}
|
data/spec/assets/invalid.json
DELETED
data/spec/helpers.rb
DELETED
data/spec/loader_spec.rb
DELETED
@@ -1,243 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "helpers")
|
2
|
-
require "sensu/settings/loader"
|
3
|
-
|
4
|
-
describe "Sensu::Settings::Loader" do
|
5
|
-
include Helpers
|
6
|
-
|
7
|
-
before do
|
8
|
-
@loader = Sensu::Settings::Loader.new
|
9
|
-
@assets_dir = File.join(File.dirname(__FILE__), "assets")
|
10
|
-
@config_file = File.join(@assets_dir, "config.json")
|
11
|
-
@config_dir = File.join(@assets_dir, "conf.d")
|
12
|
-
end
|
13
|
-
|
14
|
-
it "can provide a loader API" do
|
15
|
-
expect(@loader).to respond_to(:load_env, :load_file, :load_directory, :set_env!, :validate)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "can provide indifferent access to settings" do
|
19
|
-
expect(@loader[:checks]).to be_kind_of(Hash)
|
20
|
-
expect(@loader["checks"]).to be_kind_of(Hash)
|
21
|
-
end
|
22
|
-
|
23
|
-
it "can validate loaded settings" do
|
24
|
-
failures = @loader.validate
|
25
|
-
expect(failures.size).to eq(0)
|
26
|
-
end
|
27
|
-
|
28
|
-
it "can load Sensu client settings with auto-detected defaults" do
|
29
|
-
@loader.load_env
|
30
|
-
expect(@loader.warnings.size).to eq(0)
|
31
|
-
expect(@loader.default_settings[:client][:name]).to be_kind_of(String)
|
32
|
-
expect(@loader.default_settings[:client][:address]).to be_kind_of(String)
|
33
|
-
end
|
34
|
-
|
35
|
-
it "can load Sensu transport settings from the environment" do
|
36
|
-
ENV["SENSU_TRANSPORT_NAME"] = "redis"
|
37
|
-
@loader.load_env
|
38
|
-
expect(@loader.warnings.size).to eq(1)
|
39
|
-
warning = @loader.warnings.shift
|
40
|
-
transport = warning[:transport]
|
41
|
-
expect(transport[:name]).to eq("redis")
|
42
|
-
ENV["SENSU_TRANSPORT_NAME"] = nil
|
43
|
-
end
|
44
|
-
|
45
|
-
it "can load RabbitMQ settings from the environment" do
|
46
|
-
ENV["RABBITMQ_URL"] = "amqp://guest:guest@localhost:5672/"
|
47
|
-
@loader.load_env
|
48
|
-
expect(@loader.warnings.size).to eq(1)
|
49
|
-
warning = @loader.warnings.shift
|
50
|
-
expect(warning[:rabbitmq]).to eq("amqp://guest:guest@localhost:5672/")
|
51
|
-
ENV["RABBITMQ_URL"] = nil
|
52
|
-
end
|
53
|
-
|
54
|
-
it "can load Redis settings from the environment" do
|
55
|
-
ENV["REDIS_URL"] = "redis://:password@localhost:6789"
|
56
|
-
@loader.load_env
|
57
|
-
expect(@loader.warnings.size).to eq(1)
|
58
|
-
warning = @loader.warnings.shift
|
59
|
-
expect(warning[:redis]).to eq("redis://:password@localhost:6789")
|
60
|
-
ENV["REDIS_URL"] = nil
|
61
|
-
end
|
62
|
-
|
63
|
-
it "can load Redis Sentinel settings from the environment" do
|
64
|
-
ENV["REDIS_SENTINEL_URLS"] = "redis://10.0.0.1:26379,redis://:password@10.0.0.2:26379"
|
65
|
-
@loader.load_env
|
66
|
-
expect(@loader.warnings.size).to eq(1)
|
67
|
-
warning = @loader.warnings.shift
|
68
|
-
expect(warning[:sentinels]).to eq("redis://10.0.0.1:26379,redis://:password@10.0.0.2:26379")
|
69
|
-
ENV["REDIS_SENTINEL_URLS"] = nil
|
70
|
-
end
|
71
|
-
|
72
|
-
it "can load Sensu client settings with defaults from the environment" do
|
73
|
-
ENV["SENSU_CLIENT_NAME"] = "i-424242"
|
74
|
-
@loader.load_env
|
75
|
-
expect(@loader.warnings.size).to eq(1)
|
76
|
-
warning = @loader.warnings.shift
|
77
|
-
client = warning[:client]
|
78
|
-
expect(client[:name]).to eq("i-424242")
|
79
|
-
expect(client[:address]).to be_kind_of(String)
|
80
|
-
expect(client[:subscriptions]).to eq([])
|
81
|
-
ENV["SENSU_CLIENT_NAME"] = nil
|
82
|
-
end
|
83
|
-
|
84
|
-
it "can load Sensu client settings with defaults from the environment" do
|
85
|
-
ENV["SENSU_CLIENT_NAME"] = "i-424242"
|
86
|
-
ENV["SENSU_CLIENT_ADDRESS"] = "127.0.0.1"
|
87
|
-
ENV["SENSU_CLIENT_SUBSCRIPTIONS"] = "foo,bar,baz"
|
88
|
-
@loader.load_env
|
89
|
-
expect(@loader.warnings.size).to eq(1)
|
90
|
-
warning = @loader.warnings.shift
|
91
|
-
client = warning[:client]
|
92
|
-
expect(client[:name]).to eq("i-424242")
|
93
|
-
expect(client[:address]).to eq("127.0.0.1")
|
94
|
-
expect(client[:subscriptions]).to eq(["foo", "bar", "baz"])
|
95
|
-
ENV["SENSU_CLIENT_NAME"] = nil
|
96
|
-
ENV["SENSU_CLIENT_ADDRESS"] = nil
|
97
|
-
ENV["SENSU_CLIENT_SUBSCRIPTIONS"] = nil
|
98
|
-
end
|
99
|
-
|
100
|
-
it "can load Sensu API settings from the environment" do
|
101
|
-
ENV["SENSU_API_PORT"] = "4567"
|
102
|
-
@loader.load_env
|
103
|
-
expect(@loader.warnings.size).to eq(1)
|
104
|
-
ENV["SENSU_API_PORT"] = nil
|
105
|
-
end
|
106
|
-
|
107
|
-
it "can load settings from a file" do
|
108
|
-
@loader.load_file(@config_file)
|
109
|
-
expect(@loader.warnings.size).to eq(1)
|
110
|
-
warning = @loader.warnings.first
|
111
|
-
expect(warning[:file]).to eq(File.expand_path(@config_file))
|
112
|
-
expect(warning[:message]).to eq("loading config file")
|
113
|
-
expect(@loader[:api][:port]).to eq(4567)
|
114
|
-
expect(@loader["api"]["port"]).to eq(4567)
|
115
|
-
end
|
116
|
-
|
117
|
-
it "can load settings from a file and validate them" do
|
118
|
-
@loader.load_file(@config_file)
|
119
|
-
failures = @loader.validate
|
120
|
-
reasons = failures.map do |failure|
|
121
|
-
failure[:message]
|
122
|
-
end
|
123
|
-
expect(reasons).to include("check interval must be an integer greater than 0")
|
124
|
-
end
|
125
|
-
|
126
|
-
it "can attempt to load settings from a nonexistent file" do
|
127
|
-
expect {
|
128
|
-
@loader.load_file("/tmp/bananaphone")
|
129
|
-
}.to raise_error(Sensu::Settings::Loader::Error)
|
130
|
-
expect(@loader.errors.length).to eq(1)
|
131
|
-
error = @loader.errors.first
|
132
|
-
expect(error[:message]).to include("config file does not exist or is not readable")
|
133
|
-
end
|
134
|
-
|
135
|
-
it "can attempt to load settings from a nonexistent file and ignore it" do
|
136
|
-
@loader.load_file("/tmp/bananaphone", false)
|
137
|
-
expect(@loader.errors.length).to eq(0)
|
138
|
-
expect(@loader.warnings.length).to eq(2)
|
139
|
-
warning = @loader.warnings.last
|
140
|
-
expect(warning[:message]).to include("ignoring config file")
|
141
|
-
end
|
142
|
-
|
143
|
-
it "can attempt to load settings from a file with invalid JSON" do
|
144
|
-
expect {
|
145
|
-
@loader.load_file(File.join(@assets_dir, "invalid.json"))
|
146
|
-
}.to raise_error(Sensu::Settings::Loader::Error)
|
147
|
-
expect(@loader.errors.length).to eq(1)
|
148
|
-
error = @loader.errors.first
|
149
|
-
expect(error[:message]).to include("config file must be valid json")
|
150
|
-
end
|
151
|
-
|
152
|
-
it "can load settings from a utf-8 encoded file with a bom" do
|
153
|
-
@loader.load_file(File.join(@assets_dir, "bom.json"))
|
154
|
-
warnings = @loader.warnings
|
155
|
-
failures = @loader.validate
|
156
|
-
expect(warnings.size).to eq(1)
|
157
|
-
expect(failures.size).to eq(0)
|
158
|
-
end
|
159
|
-
|
160
|
-
it "can load settings from files in a directory" do
|
161
|
-
@loader.load_directory(@config_dir)
|
162
|
-
warnings = @loader.warnings
|
163
|
-
expect(warnings.size).to eq(6)
|
164
|
-
messages = warnings.map do |warning|
|
165
|
-
warning[:message]
|
166
|
-
end
|
167
|
-
expect(messages).to include("loading config files from directory")
|
168
|
-
expect(messages).to include("loading config file")
|
169
|
-
expect(messages).to include("config file applied changes")
|
170
|
-
expect(@loader[:checks][:nested][:command]).to eq("true")
|
171
|
-
end
|
172
|
-
|
173
|
-
it "can attempt to load settings from files in a nonexistent directory" do
|
174
|
-
expect {
|
175
|
-
@loader.load_directory("/tmp/rottentomatos")
|
176
|
-
}.to raise_error(Sensu::Settings::Loader::Error)
|
177
|
-
expect(@loader.warnings.size).to eq(1)
|
178
|
-
expect(@loader.warnings.first[:message]).to eq("loading config files from directory")
|
179
|
-
expect(@loader.errors.size).to eq(1)
|
180
|
-
expect(@loader.errors.first[:message]).to eq("insufficient permissions for loading")
|
181
|
-
end
|
182
|
-
|
183
|
-
it "can set environment variables for child processes" do
|
184
|
-
@loader.load_file(@config_file)
|
185
|
-
@loader.load_directory(@config_dir)
|
186
|
-
expect(@loader.loaded_files.size).to eq(4)
|
187
|
-
@loader.set_env!
|
188
|
-
expect(ENV["SENSU_LOADED_TEMPFILE"]).to match(/sensu_rspec_loaded_files/)
|
189
|
-
loaded_files = IO.read(ENV["SENSU_LOADED_TEMPFILE"])
|
190
|
-
expect(loaded_files.split(":")).to eq(@loader.loaded_files)
|
191
|
-
end
|
192
|
-
|
193
|
-
it "can load settings and determine if certain definitions exist" do
|
194
|
-
@loader.load_file(@config_file)
|
195
|
-
@loader.load_directory(@config_dir)
|
196
|
-
expect(@loader.check_exists?("nonexistent")).to be(false)
|
197
|
-
expect(@loader.check_exists?("tokens")).to be(true)
|
198
|
-
expect(@loader.filter_exists?("nonexistent")).to be(false)
|
199
|
-
expect(@loader.filter_exists?("development")).to be(true)
|
200
|
-
expect(@loader.mutator_exists?("nonexistent")).to be(false)
|
201
|
-
expect(@loader.mutator_exists?("noop")).to be(true)
|
202
|
-
expect(@loader.handler_exists?("nonexistent")).to be(false)
|
203
|
-
expect(@loader.handler_exists?("default")).to be(true)
|
204
|
-
end
|
205
|
-
|
206
|
-
it "can load settings and provide setting category accessors" do
|
207
|
-
@loader.load_file(@config_file)
|
208
|
-
@loader.load_directory(@config_dir)
|
209
|
-
expect(@loader.checks).to be_kind_of(Array)
|
210
|
-
expect(@loader.checks).to_not be_empty
|
211
|
-
check = @loader.checks.detect do |check|
|
212
|
-
check[:name] == "tokens"
|
213
|
-
end
|
214
|
-
expect(check[:interval]).to eq(1)
|
215
|
-
expect(@loader.filters).to be_kind_of(Array)
|
216
|
-
expect(@loader.filters).to_not be_empty
|
217
|
-
filter = @loader.filters.detect do |filter|
|
218
|
-
filter[:name] == "development"
|
219
|
-
end
|
220
|
-
expect(filter[:negate]).to be(true)
|
221
|
-
expect(@loader.mutators).to be_kind_of(Array)
|
222
|
-
expect(@loader.mutators).to_not be_empty
|
223
|
-
mutator = @loader.mutators.detect do |mutator|
|
224
|
-
mutator[:name] == "noop"
|
225
|
-
end
|
226
|
-
expect(mutator[:command]).to eq("cat")
|
227
|
-
expect(@loader.handlers).to be_kind_of(Array)
|
228
|
-
expect(@loader.handlers).to_not be_empty
|
229
|
-
handler = @loader.handlers.detect do |handler|
|
230
|
-
handler[:name] == "default"
|
231
|
-
end
|
232
|
-
expect(handler[:type]).to eq("set")
|
233
|
-
end
|
234
|
-
|
235
|
-
it "can load settings overrides" do
|
236
|
-
@loader.load_file(@config_file)
|
237
|
-
@loader.load_overrides!
|
238
|
-
expect(@loader.warnings.size).to eq(2)
|
239
|
-
warning = @loader.warnings[1]
|
240
|
-
client = warning[:client]
|
241
|
-
expect(client[:subscriptions]).to include("client:i-424242")
|
242
|
-
end
|
243
|
-
end
|