rabbitmq-cluster 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rabbitmq/cluster/etcd.rb +11 -2
- data/lib/rabbitmq/cluster/server.rb +1 -1
- data/lib/rabbitmq/cluster/version.rb +1 -1
- data/spec/unit/etcd_spec.rb +8 -0
- data/spec/unit/server_spec.rb +3 -3
- metadata +3 -3
@@ -21,8 +21,11 @@ module RabbitMQ::Cluster
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def register(node_name)
|
24
|
-
|
25
|
-
|
24
|
+
client.set(key_for(node_name), node_name) unless client.exists?(key_for(node_name))
|
25
|
+
end
|
26
|
+
|
27
|
+
def deregister(node_name)
|
28
|
+
client.delete(key_for(node_name))
|
26
29
|
end
|
27
30
|
|
28
31
|
def erlang_cookie
|
@@ -35,5 +38,11 @@ module RabbitMQ::Cluster
|
|
35
38
|
erlang_cookie
|
36
39
|
)
|
37
40
|
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def key_for(node_name)
|
45
|
+
"/rabbitmq/nodes/#{node_name}"
|
46
|
+
end
|
38
47
|
end
|
39
48
|
end
|
data/spec/unit/etcd_spec.rb
CHANGED
@@ -55,6 +55,14 @@ describe RabbitMQ::Cluster::Etcd do
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
describe '#deregister' do
|
59
|
+
it 'deletes the correct key' do
|
60
|
+
expect(etcd_client).to receive(:delete)
|
61
|
+
.with('/rabbitmq/nodes/rabbit@foobah')
|
62
|
+
subject.deregister('rabbit@foobah')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
58
66
|
describe '#erlang_cookie' do
|
59
67
|
let(:erlang_cookie) { 'afbdgCVB23423bh324h' }
|
60
68
|
before do
|
data/spec/unit/server_spec.rb
CHANGED
@@ -208,7 +208,7 @@ describe RabbitMQ::Cluster::Server do
|
|
208
208
|
{"name" => "rabbit@node2", "running" => false}
|
209
209
|
])
|
210
210
|
allow(subject).to receive(:"`")
|
211
|
-
allow(etcd).to receive(:
|
211
|
+
allow(etcd).to receive(:deregister)
|
212
212
|
end
|
213
213
|
|
214
214
|
it 'aquires the lock before doing anything' do
|
@@ -223,8 +223,8 @@ describe RabbitMQ::Cluster::Server do
|
|
223
223
|
end
|
224
224
|
|
225
225
|
it 'removes the stopped node from etcd' do
|
226
|
-
expect(etcd).to receive(:
|
227
|
-
.with('
|
226
|
+
expect(etcd).to receive(:deregister)
|
227
|
+
.with('rabbit@node2')
|
228
228
|
subject.synchronize
|
229
229
|
end
|
230
230
|
end
|
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.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -144,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
segments:
|
146
146
|
- 0
|
147
|
-
hash:
|
147
|
+
hash: -4211619239378065739
|
148
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
version: '0'
|
154
154
|
segments:
|
155
155
|
- 0
|
156
|
-
hash:
|
156
|
+
hash: -4211619239378065739
|
157
157
|
requirements: []
|
158
158
|
rubyforge_project:
|
159
159
|
rubygems_version: 1.8.25
|