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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a3b68af5fa2b3851d89d2bc21e70f31bc347f66
4
- data.tar.gz: abf13231be9912d9670501efa6aea0a643768fdd
3
+ metadata.gz: 55796663bf6f9d0a6914ea5cea9d27b44c543f45
4
+ data.tar.gz: 6bcaa3bf6b074d180785048ee9374e8df94e34dc
5
5
  SHA512:
6
- metadata.gz: 48f93ad1c08845034ce367a69ac017e56edf6f1d3e87800bad19d447dcd1a385bef1ccfa12500a2743023e7f3d92449964bbd1f25b8dcd8169e2ea35c8678421
7
- data.tar.gz: 860f858c07cc5dd1f17f9d580fa3c0192d01b4f3a6d8b6af84d275cf2f37dcfef62a00608415a78ee1de51a41e80cbbd39b2b07dccbaf810ded152f0f0a7155b
6
+ metadata.gz: 0094ba6437ef8eeacf8c03afec45054525af2cf2d9c12ec282a77bdae0bf2ed775f46f777000687303efe63ddf4aeadd3e45221d552d4997bbbc2c685ed84265
7
+ data.tar.gz: 127d912972a1907377f3ef281d989a55f2446cbfce6166f22991fff966fd11344e7b8468cf4ce0969a8e9bde21d4c8749144d8f64852ecb7e4849450613d08cf
@@ -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
- begin
20
- Timeout::timeout(timeout_duration) do
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
@@ -1,3 +1,3 @@
1
1
  module Cellect
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  end
@@ -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
- pass_until node_set, is: :ready
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(obj, is:)
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
- pass_until node_set, is: :ready
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
- pass_until node_set, is: :ready
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
- pass_until node_set, is: :ready
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.2.0
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: 2015-12-22 00:00:00.000000000 Z
11
+ date: 2016-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler