sensu-extension 0.0.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/sensu-extension.gemspec +1 -1
- data/spec/base_spec.rb +22 -22
- data/spec/categories_spec.rb +8 -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: 0680704719c55e664017e91b929e6d135e368b77
|
4
|
+
data.tar.gz: 533607808f1461e94c480f89fc1e1f55ebf875cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d4b442dd58950a85146b0c96047311d83abc35e080aae08b6a769637f20288580343c0a5bf16d0d98a3fed96743e16d8f59a2db7a6b9209504cfe5919e8fe88
|
7
|
+
data.tar.gz: d56ea3ff5ba6e3cd776a4139b9dfa9bd39c7c3584c5eeb26e172230574e5dc6fe85b119d181bfb8fe814db7082ea106d8612161bb5260776082d3ed589d1e9cd
|
data/sensu-extension.gemspec
CHANGED
data/spec/base_spec.rb
CHANGED
@@ -10,22 +10,22 @@ describe "Sensu::Extension::Base" do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "can provide the extension API" do
|
13
|
-
@extension.
|
13
|
+
expect(@extension).to respond_to(:name, :description, :definition, :safe_run, :has_key?, :[])
|
14
14
|
end
|
15
15
|
|
16
16
|
it "can provide default method return values" do
|
17
|
-
@extension.post_init.
|
18
|
-
@extension.stop.
|
19
|
-
@extension.name.
|
20
|
-
@extension.description.
|
21
|
-
@extension.definition.
|
17
|
+
expect(@extension.post_init).to be(true)
|
18
|
+
expect(@extension.stop).to be(true)
|
19
|
+
expect(@extension.name).to eq("base")
|
20
|
+
expect(@extension.description).to eq("extension description (change me)")
|
21
|
+
expect(@extension.definition).to eq({:type => "extension", :name => "base"})
|
22
22
|
end
|
23
23
|
|
24
24
|
it "can have a logger" do
|
25
25
|
@extension.logger = Logger.new("/dev/null")
|
26
26
|
@extension.logger.formatter = Proc.new do |severity, datetime, progname, message|
|
27
|
-
severity.
|
28
|
-
message.
|
27
|
+
expect(severity).to eq("INFO")
|
28
|
+
expect(message).to eq("test")
|
29
29
|
end
|
30
30
|
@extension.logger.info("test")
|
31
31
|
end
|
@@ -33,14 +33,14 @@ describe "Sensu::Extension::Base" do
|
|
33
33
|
it "can have settings" do
|
34
34
|
settings = {:foo => 1}
|
35
35
|
@extension.settings = settings
|
36
|
-
@extension.settings.
|
36
|
+
expect(@extension.settings).to eq(settings)
|
37
37
|
end
|
38
38
|
|
39
39
|
it "can run without data" do
|
40
40
|
async_wrapper do
|
41
41
|
callback = Proc.new do |output, status|
|
42
|
-
output.
|
43
|
-
status.
|
42
|
+
expect(output).to eq("noop")
|
43
|
+
expect(status).to eq(0)
|
44
44
|
async_done
|
45
45
|
end
|
46
46
|
@extension.run(&callback)
|
@@ -50,8 +50,8 @@ describe "Sensu::Extension::Base" do
|
|
50
50
|
it "can run with event data" do
|
51
51
|
async_wrapper do
|
52
52
|
callback = Proc.new do |output, status|
|
53
|
-
output.
|
54
|
-
status.
|
53
|
+
expect(output).to eq("noop")
|
54
|
+
expect(status).to eq(0)
|
55
55
|
async_done
|
56
56
|
end
|
57
57
|
event = {:foo => 1}
|
@@ -63,8 +63,8 @@ describe "Sensu::Extension::Base" do
|
|
63
63
|
async_wrapper do
|
64
64
|
event = {:foo => 1}
|
65
65
|
@extension.safe_run(event) do |output, status|
|
66
|
-
output.
|
67
|
-
status.
|
66
|
+
expect(output).to eq("noop")
|
67
|
+
expect(status).to eq(0)
|
68
68
|
async_done
|
69
69
|
end
|
70
70
|
end
|
@@ -74,18 +74,18 @@ describe "Sensu::Extension::Base" do
|
|
74
74
|
async_wrapper do
|
75
75
|
@extension.safe_run do |output, status|
|
76
76
|
raise "boom" if status == 0
|
77
|
-
output.
|
78
|
-
status.
|
77
|
+
expect(output).to eq("boom")
|
78
|
+
expect(status).to eq(2)
|
79
79
|
async_done
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
84
|
it "can provide hash like access to definition()" do
|
85
|
-
@extension.has_key?(:type).
|
86
|
-
@extension.has_key?(:name).
|
87
|
-
@extension[:type].
|
88
|
-
@extension[:name].
|
85
|
+
expect(@extension.has_key?(:type)).to be(true)
|
86
|
+
expect(@extension.has_key?(:name)).to be(true)
|
87
|
+
expect(@extension[:type]).to eq("extension")
|
88
|
+
expect(@extension[:name]).to eq("base")
|
89
89
|
end
|
90
90
|
|
91
91
|
it "can provide a list of decendant classes" do
|
@@ -95,6 +95,6 @@ describe "Sensu::Extension::Base" do
|
|
95
95
|
Sensu::Extension::Mutator,
|
96
96
|
Sensu::Extension::Handler
|
97
97
|
]
|
98
|
-
Sensu::Extension::Base.descendants.
|
98
|
+
expect(Sensu::Extension::Base.descendants).to include(*expected)
|
99
99
|
end
|
100
100
|
end
|
data/spec/categories_spec.rb
CHANGED
@@ -5,9 +5,9 @@ describe "Sensu::Extension::Bridge" do
|
|
5
5
|
include Helpers
|
6
6
|
|
7
7
|
it "inherits Base" do
|
8
|
-
Sensu::Extension::Bridge.superclass.
|
8
|
+
expect(Sensu::Extension::Bridge.superclass).to eq(Sensu::Extension::Base)
|
9
9
|
extension = Sensu::Extension::Bridge.new
|
10
|
-
extension.
|
10
|
+
expect(extension).to respond_to(:name, :description, :definition, :safe_run, :stop, :has_key?, :[])
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -15,9 +15,9 @@ describe "Sensu::Extension::Check" do
|
|
15
15
|
include Helpers
|
16
16
|
|
17
17
|
it "inherits Base" do
|
18
|
-
Sensu::Extension::Check.superclass.
|
18
|
+
expect(Sensu::Extension::Check.superclass).to eq(Sensu::Extension::Base)
|
19
19
|
extension = Sensu::Extension::Check.new
|
20
|
-
extension.
|
20
|
+
expect(extension).to respond_to(:name, :description, :definition, :safe_run, :stop, :has_key?, :[])
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -25,9 +25,9 @@ describe "Sensu::Extension::Mutator" do
|
|
25
25
|
include Helpers
|
26
26
|
|
27
27
|
it "inherits Base" do
|
28
|
-
Sensu::Extension::Mutator.superclass.
|
28
|
+
expect(Sensu::Extension::Mutator.superclass).to eq(Sensu::Extension::Base)
|
29
29
|
extension = Sensu::Extension::Mutator.new
|
30
|
-
extension.
|
30
|
+
expect(extension).to respond_to(:name, :description, :definition, :safe_run, :stop, :has_key?, :[])
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -35,8 +35,8 @@ describe "Sensu::Extension::Handler" do
|
|
35
35
|
include Helpers
|
36
36
|
|
37
37
|
it "inherits Base" do
|
38
|
-
Sensu::Extension::Handler.superclass.
|
38
|
+
expect(Sensu::Extension::Handler.superclass).to eq(Sensu::Extension::Base)
|
39
39
|
extension = Sensu::Extension::Handler.new
|
40
|
-
extension.
|
40
|
+
expect(extension).to respond_to(:name, :description, :definition, :safe_run, :stop, :has_key?, :[])
|
41
41
|
end
|
42
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
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-
|
11
|
+
date: 2014-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-em
|