cellect-client 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cellect/node_set.rb +2 -4
- data/lib/cellect/version.rb +1 -1
- data/spec/client/node_set_spec.rb +1 -1
- data/spec/support/cellect_helper.rb +10 -1
- data/spec/support/shared_examples_for_node_set.rb +3 -3
- 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: 55796663bf6f9d0a6914ea5cea9d27b44c543f45
|
4
|
+
data.tar.gz: 6bcaa3bf6b074d180785048ee9374e8df94e34dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0094ba6437ef8eeacf8c03afec45054525af2cf2d9c12ec282a77bdae0bf2ed775f46f777000687303efe63ddf4aeadd3e45221d552d4997bbbc2c685ed84265
|
7
|
+
data.tar.gz: 127d912972a1907377f3ef281d989a55f2446cbfce6166f22991fff966fd11344e7b8468cf4ce0969a8e9bde21d4c8749144d8f64852ecb7e4849450613d08cf
|
data/lib/cellect/node_set.rb
CHANGED
@@ -16,10 +16,8 @@ module Cellect
|
|
16
16
|
|
17
17
|
# Connect to ZooKeeper, setup this node, and change state
|
18
18
|
def initialize_zk
|
19
|
-
|
20
|
-
|
21
|
-
self.zk = ZK.new zk_url, chroot: '/cellect'
|
22
|
-
end
|
19
|
+
Timeout::timeout(timeout_duration) do
|
20
|
+
self.zk = ZK.new zk_url, chroot: '/cellect'
|
23
21
|
end
|
24
22
|
setup
|
25
23
|
self.state = :ready
|
data/lib/cellect/version.rb
CHANGED
@@ -10,7 +10,7 @@ module Cellect::Client
|
|
10
10
|
# see Cellect::Client / Cellect::Server
|
11
11
|
it 'should update the node list when changing' do
|
12
12
|
begin
|
13
|
-
|
13
|
+
pass_until_state_of node_set, is: :ready
|
14
14
|
node_set.zk.create '/nodes/node', data: 'foo', mode: :ephemeral_sequential
|
15
15
|
100.times do |i|
|
16
16
|
break if node_set.nodes['node0000000001']
|
@@ -1,7 +1,16 @@
|
|
1
1
|
require 'timeout'
|
2
2
|
|
3
3
|
module CellectHelper
|
4
|
-
def pass_until(
|
4
|
+
def pass_until(&block)
|
5
|
+
Timeout::timeout(1) do
|
6
|
+
Thread.pass until block.call
|
7
|
+
end
|
8
|
+
rescue => e
|
9
|
+
puts "Timeout waiting for condition #{ block.inspect }"
|
10
|
+
raise e
|
11
|
+
end
|
12
|
+
|
13
|
+
def pass_until_state_of(obj, is:)
|
5
14
|
Timeout::timeout(1) do
|
6
15
|
Thread.pass until obj.state == is
|
7
16
|
end
|
@@ -3,20 +3,20 @@ shared_examples_for 'node set' do
|
|
3
3
|
|
4
4
|
it 'should connect to zoo keeper' do
|
5
5
|
expect(node_set.zk).to be_nil
|
6
|
-
|
6
|
+
pass_until_state_of node_set, is: :ready
|
7
7
|
expect(node_set.zk).to be_connected
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should know the connection state' do
|
11
11
|
expect(node_set.state).to be :initializing
|
12
|
-
|
12
|
+
pass_until_state_of node_set, is: :ready
|
13
13
|
expect(node_set).to be_ready
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'should accept a connection string' do
|
17
17
|
url_before = ENV['ZK_URL']
|
18
18
|
begin
|
19
|
-
|
19
|
+
pass_until_state_of node_set, is: :ready
|
20
20
|
ENV['ZK_URL'] = 'foobar'
|
21
21
|
expect(node_set.send(:zk_url)).to eq 'foobar'
|
22
22
|
ENV.delete 'ZK_URL'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cellect-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Parrish
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|