sensu-settings 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad536528eb8bf91f1470fae3523172d95a5385e5
4
- data.tar.gz: 23d2d733d4b216b7660d4d58216edeb0070e041c
3
+ metadata.gz: d277de9e92b8519137b265ed9666ce0cce3aaa06
4
+ data.tar.gz: 38c20f11b6b6cb115caf7d75e7222568794f94a0
5
5
  SHA512:
6
- metadata.gz: b61759a73625b9dc32700ed75fba57c2be7ab41fe5478eeed317c536a51097ebfb3a4263e22a848b4c3aa8f695dd3f404000619b5408bf050ac05ef1e5a9303a
7
- data.tar.gz: 69b96d5e8b2e9511ac5404649066457f2175bcf5bee6edbc71c45e3a2ac661f8b4287870ad20373d96f5888a79e682cd51044a4853d83645ea1ec40999b162fc
6
+ metadata.gz: 77b6db2d55c2e48c2f3185da13d5a867f84b66980abef62e2925332ea85de93b6c6b395541bb148688b70219162f1ab25bafeed2f4ffc86d84150c69f884ffbf
7
+ data.tar.gz: 1f9b6cbce8d495d96ef5cded2066be88a853219e901db0d65f8d2fe94dfb92b57654813ce70b51dc057c28894da6dfc8beaa3a59b8114a7a970da00bae111eea
@@ -14,7 +14,9 @@ module Sensu
14
14
 
15
15
  def initialize
16
16
  @warnings = []
17
- @settings = {}
17
+ @settings = {
18
+ :transport => {}
19
+ }
18
20
  CATEGORIES.each do |category|
19
21
  @settings[category] = {}
20
22
  end
@@ -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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "sensu-settings"
5
- spec.version = "0.0.5"
5
+ spec.version = "0.0.6"
6
6
  spec.authors = ["Sean Porter"]
7
7
  spec.email = ["portertech@gmail.com"]
8
8
  spec.summary = "The Sensu settings library, loader and validator"
@@ -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(4)
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(0)
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(4)
229
+ @validator.reset.should eq(5)
224
230
  settings[:checks][:foo][:interval] = 1
225
231
  @validator.run(settings)
226
- @validator.reset.should eq(3)
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(5)
580
+ @validator.reset.should eq(6)
575
581
  settings[:client][:subscriptions] = ["bar"]
576
582
  @validator.run(settings, "client")
577
- @validator.reset.should eq(4)
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(5)
626
+ @validator.reset.should eq(6)
621
627
  settings[:api][:port] = 4567
622
628
  @validator.run(settings, "api")
623
- @validator.reset.should eq(4)
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.5
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-27 00:00:00.000000000 Z
11
+ date: 2014-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json