zookeeper 1.5.3 → 1.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +6 -0
- data/CHANGELOG +3 -0
- data/Gemfile +2 -2
- data/Rakefile +2 -2
- data/ext/Rakefile +2 -2
- data/ext/extconf.rb +2 -2
- data/lib/zookeeper/version.rb +1 -1
- data/spec/c_zookeeper_spec.rb +6 -6
- data/spec/chrooted_connection_spec.rb +8 -8
- data/spec/compatibilty_spec.rb +1 -1
- data/spec/default_watcher_spec.rb +6 -6
- data/spec/em_spec.rb +3 -3
- data/spec/ext/zookeeper_base_spec.rb +1 -1
- data/spec/forked_connection_spec.rb +4 -4
- data/spec/latch_spec.rb +1 -1
- data/spec/shared/all_success_return_values.rb +2 -2
- data/spec/shared/connection_examples.rb +186 -194
- data/spec/spec_helper.rb +2 -2
- data/zookeeper.gemspec +5 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c62ad7f2a9f95282d970313d90b627ebcf8d289c59f08a00ed3a44e787d27040
|
4
|
+
data.tar.gz: af6af88a8bc969ffdad9889a7fa7167158dbb9bff5cf114d0dcadbf07ce0a63a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43fd7c61e195c54e5fab825685c2e8470b529e374a72c5f47da5efb48ae863dfe2385e48dd4c2d165f10b953169b405807612876523b6845cc3cd00e27ec51b3
|
7
|
+
data.tar.gz: 73afb9f450c1bcd38b4b998d919ca309606d12167adfd5369ff08d4912b73cc88aaabdd5e1cd1afbce049eaa2ac46fe7b33fdb159985881d51579dfd28eead21
|
data/.github/workflows/build.yml
CHANGED
@@ -15,6 +15,7 @@ jobs:
|
|
15
15
|
matrix:
|
16
16
|
os:
|
17
17
|
- ubuntu-latest
|
18
|
+
- ubuntu-20.04
|
18
19
|
- macos-latest
|
19
20
|
ruby:
|
20
21
|
- '2.5'
|
@@ -22,6 +23,7 @@ jobs:
|
|
22
23
|
- '2.7'
|
23
24
|
- '3.0'
|
24
25
|
- '3.1'
|
26
|
+
- '3.2'
|
25
27
|
- 'jruby'
|
26
28
|
gcc:
|
27
29
|
- 7
|
@@ -29,6 +31,10 @@ jobs:
|
|
29
31
|
exclude:
|
30
32
|
- os: macos-latest
|
31
33
|
gcc: 7
|
34
|
+
- os: ubuntu-latest
|
35
|
+
gcc: 7
|
36
|
+
- os: ubuntu-20.04
|
37
|
+
gcc: latest
|
32
38
|
|
33
39
|
steps:
|
34
40
|
- uses: actions/checkout@v2
|
data/CHANGELOG
CHANGED
data/Gemfile
CHANGED
@@ -2,10 +2,10 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem 'rake', '
|
5
|
+
gem 'rake', '>= 13.0'
|
6
6
|
|
7
7
|
group :test do
|
8
|
-
gem "rspec" , "~>
|
8
|
+
gem "rspec" , "~> 3.0"
|
9
9
|
gem 'eventmachine', '1.0.4'
|
10
10
|
gem 'evented-spec', '~> 0.9.0'
|
11
11
|
gem 'zk-server', '~> 1.0', :git => 'https://github.com/zk-ruby/zk-server.git'
|
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ release_ops_path = File.expand_path('../releaseops/lib', __FILE__)
|
|
4
4
|
# we use a submodule because it doesn't depend on anything else (*cough* bundler)
|
5
5
|
# and can be shared across projects
|
6
6
|
#
|
7
|
-
if File.
|
7
|
+
if File.exist?(release_ops_path)
|
8
8
|
require File.join(release_ops_path, 'releaseops')
|
9
9
|
|
10
10
|
# sets up the multi-ruby zk:test_all rake tasks
|
@@ -17,7 +17,7 @@ if File.exists?(release_ops_path)
|
|
17
17
|
# Define a task to run code coverage tests
|
18
18
|
ReleaseOps::TestTasks.define_simplecov_tasks
|
19
19
|
|
20
|
-
# set up yard:server, yard:gems, and yard:clean tasks
|
20
|
+
# set up yard:server, yard:gems, and yard:clean tasks
|
21
21
|
# for doing documentation stuff
|
22
22
|
ReleaseOps::YardTasks.define
|
23
23
|
|
data/ext/Rakefile
CHANGED
@@ -4,9 +4,9 @@ ZKRB_WRAPPER = %w[zkrb_wrapper.c zkrb_wrapper.h]
|
|
4
4
|
|
5
5
|
namespace :zkrb do
|
6
6
|
task :clean do
|
7
|
-
if File.
|
7
|
+
if File.exist?('Makefile')
|
8
8
|
sh 'make clean'
|
9
|
-
rm
|
9
|
+
FileUtils.rm('Makefile') # yep, regenerate this
|
10
10
|
else
|
11
11
|
$stderr.puts "nothing to clean, no Makefile"
|
12
12
|
end
|
data/ext/extconf.rb
CHANGED
@@ -58,7 +58,7 @@ Dir.chdir(HERE) do
|
|
58
58
|
else
|
59
59
|
puts "Building zkc."
|
60
60
|
|
61
|
-
unless File.
|
61
|
+
unless File.exist?('c')
|
62
62
|
safe_sh "tar xzf #{BUNDLE} 2>&1"
|
63
63
|
PATCHES.each do |patch|
|
64
64
|
safe_sh "patch -p0 < #{patch} 2>&1"
|
@@ -87,7 +87,7 @@ Dir.chdir("#{HERE}/lib") do
|
|
87
87
|
%w[a la dylib].each do |ext|
|
88
88
|
origin_lib_name = "libzookeeper_#{stmt}.#{ext}"
|
89
89
|
dest_lib_name = "libzookeeper_#{stmt}_gem.#{ext}"
|
90
|
-
system("cp -f #{origin_lib_name} #{dest_lib_name}") if File.
|
90
|
+
system("cp -f #{origin_lib_name} #{dest_lib_name}") if File.exist?(origin_lib_name)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
data/lib/zookeeper/version.rb
CHANGED
data/spec/c_zookeeper_spec.rb
CHANGED
@@ -29,20 +29,20 @@ unless defined?(::JRUBY_VERSION)
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it %[should be in connected state within a reasonable amount of time] do
|
32
|
-
wait_until_connected.
|
32
|
+
expect(wait_until_connected).to be_truthy
|
33
33
|
end
|
34
34
|
|
35
35
|
describe :after_connected do
|
36
36
|
before do
|
37
|
-
wait_until_connected.
|
37
|
+
expect(wait_until_connected).to be_truthy
|
38
38
|
end
|
39
39
|
|
40
40
|
it %[should have a connection event after being connected] do
|
41
41
|
event = wait_until(10) { @event_queue.pop }
|
42
|
-
event.
|
43
|
-
event[:req_id].
|
44
|
-
event[:type].
|
45
|
-
event[:state].
|
42
|
+
expect(event).to be
|
43
|
+
expect(event[:req_id]).to eq(Zookeeper::Constants::ZKRB_GLOBAL_CB_REQ)
|
44
|
+
expect(event[:type]).to eq(Zookeeper::Constants::ZOO_SESSION_EVENT)
|
45
|
+
expect(event[:state]).to eq(Zookeeper::Constants::ZOO_CONNECTED_STATE)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -3,7 +3,7 @@ require 'shared/connection_examples'
|
|
3
3
|
|
4
4
|
describe 'Zookeeper chrooted' do
|
5
5
|
let(:path) { "/_zkchroottest_" }
|
6
|
-
let(:data) { "underpants" }
|
6
|
+
let(:data) { "underpants" }
|
7
7
|
let(:chroot_path) { '/slyphon-zookeeper-chroot' }
|
8
8
|
|
9
9
|
let(:connection_string) { "#{Zookeeper.default_cnx_str}#{chroot_path}" }
|
@@ -35,8 +35,8 @@ describe 'Zookeeper chrooted' do
|
|
35
35
|
|
36
36
|
it %[should successfully create the path] do
|
37
37
|
rv = zk.create(:path => '/', :data => '')
|
38
|
-
rv[:rc].
|
39
|
-
rv[:path].
|
38
|
+
expect(rv[:rc]).to be_zero
|
39
|
+
expect(rv[:path]).to eq('')
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
@@ -53,8 +53,8 @@ describe 'Zookeeper chrooted' do
|
|
53
53
|
|
54
54
|
it %[should return ZNONODE] do
|
55
55
|
rv = zk.create(:path => '/', :data => '')
|
56
|
-
rv[:rc].
|
57
|
-
rv[:rc].
|
56
|
+
expect(rv[:rc]).not_to be_zero
|
57
|
+
expect(rv[:rc]).to eq(Zookeeper::Exceptions::ZNONODE)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
@@ -62,15 +62,15 @@ describe 'Zookeeper chrooted' do
|
|
62
62
|
|
63
63
|
|
64
64
|
describe do
|
65
|
-
before :
|
66
|
-
logger.warn "running before :
|
65
|
+
before :each do
|
66
|
+
logger.warn "running before :each"
|
67
67
|
|
68
68
|
with_open_zk do |z|
|
69
69
|
z.create(:path => chroot_path, :data => '')
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
after :
|
73
|
+
after :each do
|
74
74
|
with_open_zk do |z|
|
75
75
|
rm_rf(z, chroot_path)
|
76
76
|
end
|
data/spec/compatibilty_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'Compatibiliy layer' do
|
4
4
|
it %[should raise the correct error when a const is missing] do
|
5
|
-
|
5
|
+
expect { Zookeeper::THISISANINVALIDCONST }.to raise_error(NameError)
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -4,7 +4,7 @@ describe Zookeeper do
|
|
4
4
|
describe :initialize, 'with watcher block' do
|
5
5
|
before do
|
6
6
|
@events = []
|
7
|
-
@watch_block = lambda do |hash|
|
7
|
+
@watch_block = lambda do |hash|
|
8
8
|
logger.debug "watch_block: #{hash.inspect}"
|
9
9
|
@events << hash
|
10
10
|
end
|
@@ -12,7 +12,7 @@ describe Zookeeper do
|
|
12
12
|
@zk = Zookeeper.new(Zookeeper.default_cnx_str, 10, @watch_block)
|
13
13
|
|
14
14
|
wait_until(2) { @zk.connected? }
|
15
|
-
@zk.
|
15
|
+
expect(@zk).to be_connected
|
16
16
|
logger.debug "connected!"
|
17
17
|
|
18
18
|
wait_until(2) { !@events.empty? }
|
@@ -24,9 +24,9 @@ describe Zookeeper do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it %[should receive initial connection state events] do
|
27
|
-
@events.
|
28
|
-
@events.length.
|
29
|
-
@events.first[:state].
|
27
|
+
expect(@events).not_to be_empty
|
28
|
+
expect(@events.length).to eq(1)
|
29
|
+
expect(@events.first[:state]).to eq(Zookeeper::ZOO_CONNECTED_STATE)
|
30
30
|
end
|
31
31
|
|
32
32
|
it %[should receive disconnection events] do
|
@@ -34,7 +34,7 @@ describe Zookeeper do
|
|
34
34
|
@events.clear
|
35
35
|
@zk.close
|
36
36
|
wait_until(2) { !@events.empty? }
|
37
|
-
@events.
|
37
|
+
expect(@events).not_to be_empty
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
data/spec/em_spec.rb
CHANGED
@@ -20,7 +20,7 @@ describe 'ZookeeperEM' do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def teardown_and_done
|
23
|
-
@zk.close do
|
23
|
+
@zk.close do
|
24
24
|
logger.debug { "TEST: about to call done" }
|
25
25
|
EM.next_tick do
|
26
26
|
done
|
@@ -31,7 +31,7 @@ describe 'ZookeeperEM' do
|
|
31
31
|
describe 'callbacks' do
|
32
32
|
it %[should be called on the reactor thread] do
|
33
33
|
cb = lambda do |h|
|
34
|
-
EM.reactor_thread
|
34
|
+
expect(EM.reactor_thread?).to be_truthy
|
35
35
|
logger.debug { "called back on the reactor thread? #{EM.reactor_thread?}" }
|
36
36
|
teardown_and_done
|
37
37
|
end
|
@@ -39,7 +39,7 @@ describe 'ZookeeperEM' do
|
|
39
39
|
setup_zk do
|
40
40
|
@zk.on_attached do |*|
|
41
41
|
logger.debug { "on_attached called" }
|
42
|
-
rv = @zk.get(:path => '/', :callback => cb)
|
42
|
+
rv = @zk.get(:path => '/', :callback => cb)
|
43
43
|
logger.debug { "rv from @zk.get: #{rv.inspect}" }
|
44
44
|
end
|
45
45
|
end
|
@@ -112,11 +112,11 @@ unless defined?(::JRUBY_VERSION)
|
|
112
112
|
status = wait_for_child_safely(@pid)
|
113
113
|
raise "Child process did not exit, likely hung" unless status
|
114
114
|
|
115
|
-
status.
|
116
|
-
status.
|
115
|
+
expect(status).not_to be_signaled
|
116
|
+
expect(status).to be_success
|
117
117
|
|
118
|
-
event_waiter_th.join(5).
|
119
|
-
@event.
|
118
|
+
expect(event_waiter_th.join(5)).to eq(event_waiter_th)
|
119
|
+
expect(@event).not_to be_nil
|
120
120
|
end
|
121
121
|
end
|
122
122
|
end
|
data/spec/latch_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
shared_examples_for "all success return values" do
|
2
2
|
it %[should have a return code of Zookeeper::ZOK] do
|
3
|
-
@rv[:rc].
|
3
|
+
expect(@rv[:rc]).to eq(Zookeeper::ZOK)
|
4
4
|
end
|
5
5
|
|
6
6
|
it %[should have a req_id integer] do
|
7
|
-
@rv[:req_id].
|
7
|
+
expect(@rv[:req_id]).to be_kind_of(Integer)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|