sensu-transport 6.0.0 → 6.0.1

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: 22f2993451286befbcd4cfa7c294db8da1b3ed3c
4
- data.tar.gz: 0bc9a052695e553d2e61c14f41848813f848f20b
3
+ metadata.gz: 7ba806650db7e6211a83b2040a4260ac820c8aea
4
+ data.tar.gz: e5bce79221bc9c26b3e1ec71b62a79f735c1c22b
5
5
  SHA512:
6
- metadata.gz: 4c2621146d89e2914ade08fd30900e9044f9b8394429f13bb8d6f500bce2b343dee1d265ed1309006f72804a03aac22dd582731bf226207266aa088756e55d39
7
- data.tar.gz: 0d4657673c2830857c1fa04ade2977cf8334040c69076620ff4e8507d095856cd98bb52c59fa68e4de3f3ad8b790f40fae02a46530fcf9b113698892735531c9
6
+ metadata.gz: 39af5f193e627206dc98e7bba305ca8251c9773933bd55dee2625709593e9601c388a83fc52f067dfb326381810c82d9649231cfff08a307177d90e53f071747
7
+ data.tar.gz: 2bd0a84d1ede40661f886570fa7a27c76bcb45553dba4d1412c79df1ab547dde7540d0fb5c7e4655931cabfda211ed550dc58dba9ac828ef1237b5b62b64f8ae
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "sensu-transport"
5
- spec.version = "6.0.0"
5
+ spec.version = "6.0.1"
6
6
  spec.authors = ["Sean Porter"]
7
7
  spec.email = ["portertech@gmail.com"]
8
8
  spec.summary = "The Sensu transport abstraction library"
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.homepage = "https://github.com/sensu/sensu-transport"
11
11
  spec.license = "MIT"
12
12
 
13
- spec.files = `git ls-files -z`.split("\x0")
13
+ spec.files = Dir.glob("lib/**/*") + %w[sensu-transport.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-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.0.1
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-04-28 00:00:00.000000000 Z
11
+ date: 2016-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
@@ -129,29 +129,14 @@ executables: []
129
129
  extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
- - ".gitignore"
133
- - ".travis.yml"
134
- - Gemfile
135
132
  - LICENSE.txt
136
133
  - README.md
137
- - Rakefile
138
134
  - lib/sensu/transport.rb
139
135
  - lib/sensu/transport/base.rb
140
136
  - lib/sensu/transport/patches/amqp.rb
141
137
  - lib/sensu/transport/rabbitmq.rb
142
138
  - lib/sensu/transport/redis.rb
143
139
  - sensu-transport.gemspec
144
- - spec/assets/rabbitmq.config
145
- - spec/assets/ssl/ca/cacert.pem
146
- - spec/assets/ssl/client/cert.pem
147
- - spec/assets/ssl/client/key.pem
148
- - spec/assets/ssl/server/cert.pem
149
- - spec/assets/ssl/server/key.pem
150
- - spec/base_spec.rb
151
- - spec/helpers.rb
152
- - spec/rabbitmq_spec.rb
153
- - spec/redis_spec.rb
154
- - spec/transport_spec.rb
155
140
  homepage: https://github.com/sensu/sensu-transport
156
141
  licenses:
157
142
  - MIT
@@ -176,15 +161,4 @@ rubygems_version: 2.6.3
176
161
  signing_key:
177
162
  specification_version: 4
178
163
  summary: The Sensu transport abstraction library
179
- test_files:
180
- - spec/assets/rabbitmq.config
181
- - spec/assets/ssl/ca/cacert.pem
182
- - spec/assets/ssl/client/cert.pem
183
- - spec/assets/ssl/client/key.pem
184
- - spec/assets/ssl/server/cert.pem
185
- - spec/assets/ssl/server/key.pem
186
- - spec/base_spec.rb
187
- - spec/helpers.rb
188
- - spec/rabbitmq_spec.rb
189
- - spec/redis_spec.rb
190
- - spec/transport_spec.rb
164
+ test_files: []
data/.gitignore DELETED
@@ -1,23 +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
23
- vendor
data/.travis.yml DELETED
@@ -1,16 +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
- services:
11
- - rabbitmq
12
- - redis
13
- notifications:
14
- irc:
15
- - "irc.freenode.net#sensu"
16
- script: "bundle exec rspec . --tag ~ssl"
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in sensu-transport.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
@@ -1,10 +0,0 @@
1
- [
2
- {rabbit, [
3
- {ssl_listeners, [5671]},
4
- {ssl_options, [{cacertfile,"spec/assets/ssl/ca/cacert.pem"},
5
- {certfile,"spec/assets/ssl/server/cert.pem"},
6
- {keyfile,"spec/assets/ssl/server/key.pem"},
7
- {verify,verify_peer},
8
- {fail_if_no_peer_cert,true}]}
9
- ]}
10
- ].
@@ -1,17 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIICxDCCAaygAwIBAgIJAIWLvLqOUGk9MA0GCSqGSIb3DQEBBQUAMBIxEDAOBgNV
3
- BAMTB1Nlbn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Sska29jRcxsbjhu7autRzUfrvqPLH5i9pnqBfehkY
24
- SFCOyY4xAoGBAKgz/CLq51tmBypb7oy6Cxz1j5wbTQlvrN8MPkMG5dhILAqk3FjM
25
- HxAsmx/Uy6MfrqpF+Cfp3ABEps+cfwn7zemqppR3OmeEnFDd+6z8sJ28GbFn6ZPK
26
- wdN/Ggzkz1igCCRGuW+cRh9xhN9tJNwqSbgLib5AY8j6pAXc9PsVdBk0
27
- -----END RSA PRIVATE KEY-----
data/spec/base_spec.rb DELETED
@@ -1,39 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "helpers")
2
- require "sensu/transport/base"
3
-
4
- describe "Sensu::Transport::Base" do
5
- include Helpers
6
-
7
- before do
8
- @transport = Sensu::Transport::Base.new
9
- end
10
-
11
- it "provides a transport API (noop)" do
12
- expect(@transport).to respond_to(:on_error, :before_reconnect, :after_reconnect,
13
- :connect, :reconnect, :connected?, :close,
14
- :publish, :subscribe, :unsubscribe,
15
- :acknowledge, :ack, :stats)
16
- end
17
-
18
- it "behaves as expected" do
19
- callback = Proc.new { true }
20
- expect(@transport.on_error(&callback)).to be_kind_of(Proc)
21
- expect(@transport.before_reconnect(&callback)).to be_an_instance_of(Proc)
22
- expect(@transport.after_reconnect(&callback)).to be_an_instance_of(Proc)
23
- expect(@transport.connect).to eq(nil)
24
- expect(@transport.connect({})).to eq(nil)
25
- expect(@transport.reconnect).to eq(nil)
26
- expect(@transport.connected?).to eq(false)
27
- expect(@transport.close).to eq(nil)
28
- expect(@transport.publish("foo", "bar", "baz")).to eq(nil)
29
- expect(@transport.publish("foo", "bar", "baz", {}, &callback)).to eq(true)
30
- expect(@transport.subscribe("foo", "bar", nil, {}, &callback)).to eq(true)
31
- expect(@transport.unsubscribe).to eq(nil)
32
- expect(@transport.unsubscribe(&callback)).to eq(true)
33
- expect(@transport.acknowledge({})).to eq(nil)
34
- expect(@transport.ack({})).to eq(nil)
35
- expect(@transport.acknowledge({}, &callback)).to eq(true)
36
- expect(@transport.ack({}, &callback)).to eq(true)
37
- expect(@transport.stats("foo", &callback)).to eq(true)
38
- end
39
- end
data/spec/helpers.rb DELETED
@@ -1,29 +0,0 @@
1
- require "rspec"
2
- require "eventmachine"
3
-
4
- unless RUBY_VERSION < "1.9" || RUBY_PLATFORM =~ /java/
5
- require "codeclimate-test-reporter"
6
- CodeClimate::TestReporter.start
7
- end
8
-
9
- module Helpers
10
- def timer(delay, &callback)
11
- periodic_timer = EM::PeriodicTimer.new(delay) do
12
- callback.call
13
- periodic_timer.cancel
14
- end
15
- end
16
-
17
- def async_wrapper(&callback)
18
- EM.run do
19
- timer(10) do
20
- raise "test timed out"
21
- end
22
- callback.call
23
- end
24
- end
25
-
26
- def async_done
27
- EM.stop_event_loop
28
- end
29
- end
@@ -1,152 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "helpers")
2
- require "sensu/transport/rabbitmq"
3
- require "logger"
4
-
5
- describe "Sensu::Transport::RabbitMQ" do
6
- include Helpers
7
-
8
- before do
9
- @transport = Sensu::Transport::RabbitMQ.new
10
- @transport.logger = Logger.new(STDOUT)
11
- @transport.logger.level = Logger::FATAL
12
- end
13
-
14
- it "provides a transport API" do
15
- expect(@transport).to respond_to(:on_error, :before_reconnect, :after_reconnect,
16
- :connect, :reconnect, :connected?, :close,
17
- :publish, :subscribe, :unsubscribe,
18
- :acknowledge, :ack, :stats)
19
- end
20
-
21
- it "can publish and subscribe" do
22
- async_wrapper do
23
- @transport.connect
24
- callback = Proc.new do |message|
25
- expect(message).to eq("msg")
26
- timer(0.5) do
27
- async_done
28
- end
29
- end
30
- @transport.subscribe("direct", "foo", "baz", {}, &callback)
31
- @transport.subscribe("direct", "bar", "baz", {}, &callback)
32
- timer(1) do
33
- @transport.publish("direct", "foo", "msg") do |info|
34
- expect(info).to be_kind_of(Hash)
35
- expect(info).to be_empty
36
- end
37
- end
38
- end
39
- end
40
-
41
- it "can unsubscribe from queues and close the connection" do
42
- async_wrapper do
43
- @transport.connect
44
- @transport.subscribe("direct", "bar") do |info, message|
45
- true
46
- end
47
- timer(1) do
48
- @transport.unsubscribe do
49
- @transport.close
50
- expect(@transport.connected?).to be(false)
51
- async_done
52
- end
53
- end
54
- end
55
- end
56
-
57
- it "can open and close the connection immediately" do
58
- async_wrapper do
59
- @transport.connect
60
- @transport.close
61
- expect(@transport.connected?).to be(false)
62
- EM.next_tick do
63
- expect(@transport.connected?).to be(false)
64
- timer(1) do
65
- expect(@transport.connected?).to be(false)
66
- async_done
67
- end
68
- end
69
- end
70
- end
71
-
72
- it "can acknowledge the delivery of a message" do
73
- async_wrapper do
74
- @transport.connect
75
- @transport.subscribe("direct", "foo", "", :ack => true) do |info, message|
76
- @transport.acknowledge(info) do
77
- timer(0.5) do
78
- async_done
79
- end
80
- end
81
- end
82
- timer(1) do
83
- @transport.publish("direct", "foo", "msg") do |info|
84
- expect(info).to be_kind_of(Hash)
85
- expect(info).to be_empty
86
- end
87
- end
88
- end
89
- end
90
-
91
- it "can get queue stats, message and consumer counts" do
92
- async_wrapper do
93
- @transport.connect
94
- @transport.stats("bar") do |info|
95
- expect(info).to be_kind_of(Hash)
96
- expect(info[:messages]).to eq(0)
97
- expect(info[:consumers]).to eq(0)
98
- async_done
99
- end
100
- end
101
- end
102
-
103
- it "can fail to connect" do
104
- async_wrapper do
105
- @transport.connect(:port => 5555)
106
- expect(@transport.connected?).to be(false)
107
- async_done
108
- end
109
- end
110
-
111
- it "will throw an error if it cannot resolve a hostname" do
112
- async_wrapper do
113
- expected_error_class = case RUBY_PLATFORM
114
- when "java"
115
- Java::JavaNioChannels::UnresolvedAddressException
116
- else
117
- EventMachine::ConnectionError
118
- end
119
- expect {
120
- @transport.connect(:host => "2def33c3-cfbb-4993-b5ee-08d47f6d8793")
121
- }.to raise_error(expected_error_class)
122
- async_done
123
- end
124
- end
125
-
126
- it "can be configured for multiple brokers" do
127
- async_wrapper do
128
- @transport.connect([{:port => 5672}, {:port => 5672}])
129
- timer(2) do
130
- expect(@transport.connected?).to be(true)
131
- async_done
132
- end
133
- end
134
- end
135
-
136
- it "can use TLS", :ssl => true do
137
- ssl_dir = File.join(File.dirname(__FILE__), "assets", "ssl", "client")
138
- async_wrapper do
139
- @transport.connect(
140
- :port => 5671,
141
- :ssl => {
142
- :cert_chain_file => File.join(ssl_dir, "cert.pem"),
143
- :private_key_file => File.join(ssl_dir, "key.pem")
144
- }
145
- )
146
- timer(2) do
147
- expect(@transport.connected?).to be(true)
148
- async_done
149
- end
150
- end
151
- end
152
- end
data/spec/redis_spec.rb DELETED
@@ -1,165 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "helpers")
2
- require "sensu/transport/redis"
3
- require "logger"
4
-
5
- describe "Sensu::Transport::Redis" do
6
- include Helpers
7
-
8
- before do
9
- @transport = Sensu::Transport::Redis.new
10
- @transport.logger = Logger.new(STDOUT)
11
- @transport.logger.level = Logger::FATAL
12
- end
13
-
14
- it "provides a transport API" do
15
- expect(@transport).to respond_to(:on_error, :before_reconnect, :after_reconnect,
16
- :connect, :reconnect, :connected?, :close,
17
- :publish, :subscribe, :unsubscribe,
18
- :acknowledge, :ack, :stats)
19
- end
20
-
21
- it "can publish and subscribe to direct pipes" do
22
- async_wrapper do
23
- @transport.connect
24
- callback = Proc.new do |info, message|
25
- expect(info).to be_kind_of(Hash)
26
- expect(message).to eq("msg")
27
- timer(0.5) do
28
- async_done
29
- end
30
- end
31
- @transport.subscribe("direct", "foo", "baz", {}, &callback)
32
- @transport.subscribe("direct", "bar", "baz", {}, &callback)
33
- timer(1) do
34
- @transport.publish("direct", "foo", "msg") do |info|
35
- expect(info).to be_kind_of(Hash)
36
- expect(info[:queued]).to eq(1)
37
- end
38
- end
39
- end
40
- end
41
-
42
- it "can publish and subscribe to fanout pipes" do
43
- async_wrapper do
44
- @transport.connect
45
- callback = Proc.new do |info, message|
46
- expect(info).to be_kind_of(Hash)
47
- expect(info[:channel]).to eq("transport:0:channel:foo")
48
- expect(message).to eq("msg")
49
- timer(0.5) do
50
- async_done
51
- end
52
- end
53
- @transport.subscribe("fanout", "foo", "baz", {}, &callback)
54
- @transport.subscribe("fanout", "bar", "baz", {}, &callback)
55
- timer(1) do
56
- @transport.publish("fanout", "foo", "msg") do |info|
57
- expect(info).to be_kind_of(Hash)
58
- expect(info[:subscribers]).to eq(1)
59
- end
60
- end
61
- end
62
- end
63
-
64
- it "can scope redis pubsub to the selected database" do
65
- async_wrapper do
66
- @transport.connect(:db => 1)
67
- callback = Proc.new do |info, message|
68
- expect(info).to be_kind_of(Hash)
69
- expect(info[:channel]).to eq("transport:1:channel:foo")
70
- async_done
71
- end
72
- @transport.subscribe("fanout", "foo", "baz", {}, &callback)
73
- timer(1) do
74
- @transport.publish("fanout", "foo", "msg")
75
- end
76
- end
77
- end
78
-
79
- it "can unsubscribe and close the connection" do
80
- async_wrapper do
81
- @transport.connect
82
- @transport.subscribe("direct", "bar") do |info, message|
83
- true
84
- end
85
- timer(1) do
86
- @transport.unsubscribe do
87
- @transport.close
88
- timer(1) do
89
- expect(@transport.connected?).to be(false)
90
- async_done
91
- end
92
- end
93
- end
94
- end
95
- end
96
-
97
- it "can open and close the connection immediately" do
98
- async_wrapper do
99
- @transport.connect
100
- @transport.close
101
- timer(1) do
102
- expect(@transport.connected?).to be(false)
103
- async_done
104
- end
105
- end
106
- end
107
-
108
- it "can subscribe to a fanout pipe, reconnect, and subscribe to the same pipe again" do
109
- async_wrapper do
110
- @transport.connect
111
- callback = Proc.new do |info, message|
112
- expect(info).to be_kind_of(Hash)
113
- expect(info[:channel]).to eq("transport:0:channel:foo")
114
- expect(message).to eq("msg")
115
- timer(0.5) do
116
- async_done
117
- end
118
- end
119
- @transport.subscribe("fanout", "foo", "baz", {}, &callback)
120
- @transport.reconnect
121
- @transport.subscribe("fanout", "foo", "baz", {}, &callback)
122
- timer(1) do
123
- @transport.publish("fanout", "foo", "msg") do |info|
124
- expect(info).to be_kind_of(Hash)
125
- expect(info[:subscribers]).to eq(1)
126
- end
127
- end
128
- end
129
- end
130
-
131
- it "can get queue stats, message and consumer counts" do
132
- async_wrapper do
133
- @transport.connect
134
- @transport.stats("bar") do |info|
135
- expect(info).to be_kind_of(Hash)
136
- expect(info[:messages]).to eq(0)
137
- expect(info[:consumers]).to eq(0)
138
- async_done
139
- end
140
- end
141
- end
142
-
143
- it "can fail to connect" do
144
- async_wrapper do
145
- @transport.connect(:port => 5555)
146
- expect(@transport.connected?).to be(false)
147
- async_done
148
- end
149
- end
150
-
151
- it "will throw an error if it cannot resolve a hostname" do
152
- async_wrapper do
153
- expected_error_class = case RUBY_PLATFORM
154
- when "java"
155
- Java::JavaNioChannels::UnresolvedAddressException
156
- else
157
- EventMachine::ConnectionError
158
- end
159
- expect {
160
- @transport.connect(:host => "2def33c3-cfbb-4993-b5ee-08d47f6d8793")
161
- }.to raise_error(expected_error_class)
162
- async_done
163
- end
164
- end
165
- end
@@ -1,51 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "helpers")
2
- require "sensu/transport"
3
- require "logger"
4
-
5
- describe "Sensu::Transport" do
6
- include Helpers
7
-
8
- it "can load and connect to the rabbitmq transport" do
9
- async_wrapper do
10
- options = {}
11
- Sensu::Transport.connect("rabbitmq", options) do |transport|
12
- expect(transport.connected?).to be(true)
13
- async_done
14
- end
15
- end
16
- end
17
-
18
- it "can load and connect to the redis transport" do
19
- async_wrapper do
20
- options = {}
21
- Sensu::Transport.connect("redis", options) do |transport|
22
- expect(transport.connected?).to be(true)
23
- async_done
24
- end
25
- end
26
- end
27
-
28
- it "can set the rabbitmq transport logger" do
29
- async_wrapper do
30
- logger = Logger.new(STDOUT)
31
- Sensu::Transport.logger = logger
32
- Sensu::Transport.connect("rabbitmq") do |transport|
33
- expect(transport.logger).to eq(logger)
34
- expect(transport.logger).to respond_to(:error)
35
- async_done
36
- end
37
- end
38
- end
39
-
40
- it "can set the redis transport logger" do
41
- async_wrapper do
42
- logger = Logger.new(STDOUT)
43
- Sensu::Transport.logger = logger
44
- Sensu::Transport.connect("redis") do |transport|
45
- expect(transport.logger).to eq(logger)
46
- expect(transport.logger).to respond_to(:error)
47
- async_done
48
- end
49
- end
50
- end
51
- end