sensu-settings 0.0.5 → 0.0.6
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/lib/sensu/settings/loader.rb +3 -1
- data/lib/sensu/settings/validators/transport.rb +4 -2
- data/sensu-settings.gemspec +1 -1
- data/spec/validator_spec.rb +14 -8
- 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: d277de9e92b8519137b265ed9666ce0cce3aaa06
|
4
|
+
data.tar.gz: 38c20f11b6b6cb115caf7d75e7222568794f94a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77b6db2d55c2e48c2f3185da13d5a867f84b66980abef62e2925332ea85de93b6c6b395541bb148688b70219162f1ab25bafeed2f4ffc86d84150c69f884ffbf
|
7
|
+
data.tar.gz: 1f9b6cbce8d495d96ef5cded2066be88a853219e901db0d65f8d2fe94dfb92b57654813ce70b51dc057c28894da6dfc8beaa3a59b8114a7a970da00bae111eea
|
@@ -7,11 +7,13 @@ module Sensu
|
|
7
7
|
#
|
8
8
|
# @param transport [Hash] sensu transport definition.
|
9
9
|
def validate_transport(transport)
|
10
|
-
must_be_a_hash_if_set(transport) ||
|
11
|
-
invalid(transport, "transport must be a hash")
|
12
10
|
if is_a_hash?(transport)
|
13
11
|
must_be_a_string_if_set(transport[:name]) ||
|
14
12
|
invalid(transport, "transport name must be a string")
|
13
|
+
must_be_boolean_if_set(transport[:reconnect_on_error]) ||
|
14
|
+
invalid(transport, "transport reconnect_on_error must be boolean")
|
15
|
+
else
|
16
|
+
invalid(transport, "transport must be a hash")
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
data/sensu-settings.gemspec
CHANGED
data/spec/validator_spec.rb
CHANGED
@@ -21,13 +21,13 @@ describe "Sensu::Settings::Validator" do
|
|
21
21
|
reasons.should include("filters must be a hash")
|
22
22
|
reasons.should include("mutators must be a hash")
|
23
23
|
reasons.should include("handlers must be a hash")
|
24
|
-
reasons.size.should eq(
|
24
|
+
reasons.size.should eq(5)
|
25
25
|
end
|
26
26
|
|
27
27
|
it "can validate a transport definition" do
|
28
28
|
transport = nil
|
29
29
|
@validator.validate_transport(transport)
|
30
|
-
@validator.reset.should eq(
|
30
|
+
@validator.reset.should eq(1)
|
31
31
|
transport = {}
|
32
32
|
@validator.validate_transport(transport)
|
33
33
|
@validator.reset.should eq(0)
|
@@ -37,6 +37,12 @@ describe "Sensu::Settings::Validator" do
|
|
37
37
|
transport[:name] = "rabbitmq"
|
38
38
|
@validator.validate_transport(transport)
|
39
39
|
@validator.reset.should eq(0)
|
40
|
+
transport[:reconnect_on_error] = 1
|
41
|
+
@validator.validate_transport(transport)
|
42
|
+
@validator.reset.should eq(1)
|
43
|
+
transport[:reconnect_on_error] = false
|
44
|
+
@validator.validate_transport(transport)
|
45
|
+
@validator.reset.should eq(0)
|
40
46
|
end
|
41
47
|
|
42
48
|
it "can run, validating transport" do
|
@@ -220,10 +226,10 @@ describe "Sensu::Settings::Validator" do
|
|
220
226
|
}
|
221
227
|
}
|
222
228
|
@validator.run(settings)
|
223
|
-
@validator.reset.should eq(
|
229
|
+
@validator.reset.should eq(5)
|
224
230
|
settings[:checks][:foo][:interval] = 1
|
225
231
|
@validator.run(settings)
|
226
|
-
@validator.reset.should eq(
|
232
|
+
@validator.reset.should eq(4)
|
227
233
|
end
|
228
234
|
|
229
235
|
it "can validate a filter definition" do
|
@@ -571,10 +577,10 @@ describe "Sensu::Settings::Validator" do
|
|
571
577
|
}
|
572
578
|
}
|
573
579
|
@validator.run(settings, "client")
|
574
|
-
@validator.reset.should eq(
|
580
|
+
@validator.reset.should eq(6)
|
575
581
|
settings[:client][:subscriptions] = ["bar"]
|
576
582
|
@validator.run(settings, "client")
|
577
|
-
@validator.reset.should eq(
|
583
|
+
@validator.reset.should eq(5)
|
578
584
|
end
|
579
585
|
|
580
586
|
it "can validate an api definition" do
|
@@ -617,9 +623,9 @@ describe "Sensu::Settings::Validator" do
|
|
617
623
|
}
|
618
624
|
}
|
619
625
|
@validator.run(settings, "api")
|
620
|
-
@validator.reset.should eq(
|
626
|
+
@validator.reset.should eq(6)
|
621
627
|
settings[:api][:port] = 4567
|
622
628
|
@validator.run(settings, "api")
|
623
|
-
@validator.reset.should eq(
|
629
|
+
@validator.reset.should eq(5)
|
624
630
|
end
|
625
631
|
end
|
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: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Porter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|