rabbitmq-cluster 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rabbitmq/cluster.rb +0 -1
- data/lib/rabbitmq/cluster/etcd.rb +6 -0
- data/lib/rabbitmq/cluster/server.rb +3 -4
- data/lib/rabbitmq/cluster/version.rb +1 -1
- data/spec/unit/etcd_spec.rb +11 -0
- data/spec/unit/server_spec.rb +12 -0
- metadata +3 -3
data/lib/rabbitmq/cluster.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rabbitmq_manager'
|
2
|
+
require "rabbitmq/cluster/etcd"
|
2
3
|
|
3
4
|
class RabbitMQManager
|
4
5
|
def aliveness_test(vhost)
|
@@ -13,10 +14,8 @@ module RabbitMQ::Cluster
|
|
13
14
|
|
14
15
|
def self.build
|
15
16
|
new(
|
16
|
-
RabbitMQManager.new(ENV['RABBITMQ_MNGR'] || 'http://guest:guest@localhost:15672'),
|
17
|
-
RabbitMQ::Cluster::Etcd.
|
18
|
-
Etcd::Client.new(uri: ENV['ETCD_HOST'])
|
19
|
-
)
|
17
|
+
::RabbitMQManager.new(ENV['RABBITMQ_MNGR'] || 'http://guest:guest@localhost:15672'),
|
18
|
+
::RabbitMQ::Cluster::Etcd.build
|
20
19
|
)
|
21
20
|
end
|
22
21
|
|
data/spec/unit/etcd_spec.rb
CHANGED
@@ -4,6 +4,17 @@ describe RabbitMQ::Cluster::Etcd do
|
|
4
4
|
let(:etcd_client) { double(:etcd, connect: true) }
|
5
5
|
subject { described_class.new(etcd_client) }
|
6
6
|
|
7
|
+
describe '.build' do
|
8
|
+
before do
|
9
|
+
allow(Etcd::Client).to receive(:new).and_return(etcd_client)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'sets up an instance' do
|
13
|
+
expect(described_class).to receive(:new).with(etcd_client)
|
14
|
+
described_class.build
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
7
18
|
describe '#nodes' do
|
8
19
|
it 'returns the list of nodes registed in etcd' do
|
9
20
|
allow(etcd_client).to receive(:get).with('/rabbitmq/nodes').and_return(
|
data/spec/unit/server_spec.rb
CHANGED
@@ -6,6 +6,18 @@ describe RabbitMQ::Cluster::Server do
|
|
6
6
|
|
7
7
|
subject { described_class.new(client, etcd) }
|
8
8
|
|
9
|
+
describe '.build' do
|
10
|
+
before do
|
11
|
+
allow(RabbitMQ::Cluster::Etcd).to receive(:build).and_return(etcd)
|
12
|
+
allow(RabbitMQManager).to receive(:new).and_return(client)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'sets up an instance' do
|
16
|
+
expect(described_class).to receive(:new).with(client, etcd)
|
17
|
+
described_class.build
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
9
21
|
describe '#name' do
|
10
22
|
let(:client) do
|
11
23
|
double(
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rabbitmq-cluster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -146,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
146
146
|
version: '0'
|
147
147
|
segments:
|
148
148
|
- 0
|
149
|
-
hash:
|
149
|
+
hash: 770618519308933099
|
150
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
151
|
none: false
|
152
152
|
requirements:
|
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
155
|
version: '0'
|
156
156
|
segments:
|
157
157
|
- 0
|
158
|
-
hash:
|
158
|
+
hash: 770618519308933099
|
159
159
|
requirements: []
|
160
160
|
rubyforge_project:
|
161
161
|
rubygems_version: 1.8.25
|