zk 1.9.3 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/build.yml +55 -0
- data/.gitignore +1 -0
- data/Gemfile +18 -8
- data/README.markdown +9 -9
- data/RELEASES.markdown +28 -1
- data/lib/zk/client/base.rb +15 -0
- data/lib/zk/client/threaded.rb +3 -3
- data/lib/zk/client.rb +1 -1
- data/lib/zk/election.rb +1 -1
- data/lib/zk/event_handler.rb +16 -8
- data/lib/zk/event_handler_subscription/base.rb +1 -1
- data/lib/zk/fork_hook.rb +9 -4
- data/lib/zk/locker/locker_base.rb +14 -2
- data/lib/zk/locker/semaphore.rb +1 -3
- data/lib/zk/logger.rb +34 -0
- data/lib/zk/node_deletion_watcher.rb +4 -5
- data/lib/zk/pool.rb +12 -12
- data/lib/zk/subscription.rb +1 -1
- data/lib/zk/threaded_callback.rb +1 -1
- data/lib/zk/threadpool.rb +1 -1
- data/lib/zk/version.rb +1 -1
- data/lib/zk.rb +1 -5
- data/spec/event_catcher_spec.rb +1 -1
- data/spec/logging_progress_bar_formatter.rb +1 -1
- data/spec/message_queue_spec.rb +6 -6
- data/spec/shared/client_examples.rb +81 -81
- data/spec/shared/locker_examples.rb +13 -13
- data/spec/spec_helper.rb +12 -13
- data/spec/support/bogus_mongoid.rb +1 -1
- data/spec/support/client_forker.rb +1 -1
- data/spec/support/event_catcher.rb +1 -1
- data/spec/support/logging.rb +15 -47
- data/spec/zk/00_forked_client_integration_spec.rb +3 -3
- data/spec/zk/client/locking_and_session_death_spec.rb +2 -2
- data/spec/zk/client_spec.rb +19 -19
- data/spec/zk/election_spec.rb +44 -44
- data/spec/zk/extensions_spec.rb +2 -2
- data/spec/zk/locker/exclusive_locker_spec.rb +41 -41
- data/spec/zk/locker/locker_basic_spec.rb +55 -33
- data/spec/zk/locker/semaphore_spec.rb +39 -32
- data/spec/zk/locker/shared_exclusive_integration_spec.rb +37 -37
- data/spec/zk/locker/shared_locker_spec.rb +43 -43
- data/spec/zk/locker_spec.rb +2 -2
- data/spec/zk/module_spec.rb +25 -25
- data/spec/zk/mongoid_spec.rb +47 -47
- data/spec/zk/node_deletion_watcher_spec.rb +39 -31
- data/spec/zk/pool_spec.rb +56 -65
- data/spec/zk/threaded_callback_spec.rb +10 -10
- data/spec/zk/threadpool_spec.rb +25 -25
- data/spec/zk/watch_spec.rb +67 -79
- data/spec/zk/zookeeper_spec.rb +36 -30
- data/zk.gemspec +1 -2
- metadata +26 -47
- data/.travis.yml +0 -25
- data/lib/zk/logging.rb +0 -36
data/spec/zk/pool_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe ZK::Pool do
|
|
8
8
|
report_realtime('opening pool') do
|
9
9
|
@pool_size = 2
|
10
10
|
@connection_pool = ZK::Pool::Simple.new(connection_host, @pool_size, :watcher => :default)
|
11
|
-
@connection_pool.
|
11
|
+
expect(@connection_pool).to be_open
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -22,7 +22,7 @@ describe ZK::Pool do
|
|
22
22
|
unless th.join(5) == th
|
23
23
|
logger.warn { "Forcing pool closed!" }
|
24
24
|
@connection_pool.force_close!
|
25
|
-
th.join(5).
|
25
|
+
expect(th.join(5)).to eq(th)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -40,7 +40,7 @@ describe ZK::Pool do
|
|
40
40
|
it "should allow you to execute commands on a connection" do
|
41
41
|
@connection_pool.with_connection do |zk|
|
42
42
|
zk.create("/test_pool", "", :mode => :ephemeral)
|
43
|
-
zk.exists?("/test_pool").
|
43
|
+
expect(zk.exists?("/test_pool")).to be(true)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -48,14 +48,12 @@ describe ZK::Pool do
|
|
48
48
|
it %[should allow you to execute commands on the connection pool itself] do
|
49
49
|
@connection_pool.create('/test_pool', '', :mode => :persistent)
|
50
50
|
wait_until(2) { @connection_pool.exists?('/test_pool') }
|
51
|
-
@connection_pool.exists?('/test_pool').
|
51
|
+
expect(@connection_pool.exists?('/test_pool')).to be(true)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
describe :close_all! do
|
56
56
|
it %[should shutdown gracefully] do
|
57
|
-
release_q = Queue.new
|
58
|
-
|
59
57
|
latch = Latch.new
|
60
58
|
|
61
59
|
@about_to_block = false
|
@@ -76,30 +74,30 @@ describe ZK::Pool do
|
|
76
74
|
@cond.wait(@mutex) while @cnx.nil?
|
77
75
|
end
|
78
76
|
|
79
|
-
@cnx.
|
77
|
+
expect(@cnx).not_to be_nil
|
80
78
|
|
81
79
|
closing_th = Thread.new do
|
82
80
|
@connection_pool.close_all!
|
83
81
|
end
|
84
82
|
|
85
83
|
wait_until(5) { @connection_pool.closing? }
|
86
|
-
@connection_pool.
|
84
|
+
expect(@connection_pool).to be_closing
|
87
85
|
logger.debug { "connection pool is closing" }
|
88
86
|
|
89
|
-
|
87
|
+
expect { @connection_pool.with_connection { |c| c } }.to raise_error(ZK::Exceptions::PoolIsShuttingDownException)
|
90
88
|
|
91
89
|
latch.release
|
92
90
|
|
93
|
-
open_th.join(5).
|
91
|
+
expect(open_th.join(5)).to eq(open_th)
|
94
92
|
|
95
93
|
@connection_pool.wait_until_closed
|
96
94
|
|
97
|
-
@connection_pool.
|
95
|
+
expect(@connection_pool).to be_closed
|
98
96
|
|
99
|
-
|
100
|
-
closing_th.join(1).
|
101
|
-
open_th.join(1).
|
102
|
-
end.
|
97
|
+
expect do
|
98
|
+
expect(closing_th.join(1)).to eq(closing_th)
|
99
|
+
expect(open_th.join(1)).to eq(open_th)
|
100
|
+
end.not_to raise_error
|
103
101
|
end
|
104
102
|
end
|
105
103
|
|
@@ -111,8 +109,8 @@ describe ZK::Pool do
|
|
111
109
|
@cnx << @connection_pool.checkout
|
112
110
|
end
|
113
111
|
|
114
|
-
@cnx.length.
|
115
|
-
|
112
|
+
expect(@cnx.length).not_to be_zero
|
113
|
+
|
116
114
|
# this exc nonsense is because 1.8.7's scheduler is broken
|
117
115
|
@exc = nil
|
118
116
|
|
@@ -131,8 +129,8 @@ describe ZK::Pool do
|
|
131
129
|
|
132
130
|
@connection_pool.wait_until_closed
|
133
131
|
|
134
|
-
th.join(5).
|
135
|
-
@exc.
|
132
|
+
expect(th.join(5)).to eq(th)
|
133
|
+
expect(@exc).to be_kind_of(ZK::Exceptions::PoolIsShuttingDownException)
|
136
134
|
end
|
137
135
|
end
|
138
136
|
|
@@ -143,7 +141,7 @@ describe ZK::Pool do
|
|
143
141
|
|
144
142
|
@connection_pool.with_connection do |zk|
|
145
143
|
begin
|
146
|
-
zk.delete(@path)
|
144
|
+
zk.delete(@path)
|
147
145
|
rescue ZK::Exceptions::NoNode
|
148
146
|
end
|
149
147
|
end
|
@@ -152,63 +150,59 @@ describe ZK::Pool do
|
|
152
150
|
zk.watcher.register(@path) do |event|
|
153
151
|
|
154
152
|
@callback_called = true
|
155
|
-
event.path.
|
153
|
+
expect(event.path).to eq(@path)
|
156
154
|
end
|
157
155
|
|
158
|
-
zk.exists?(@path, :watch => true).
|
156
|
+
expect(zk.exists?(@path, :watch => true)).to be(false)
|
159
157
|
end
|
160
158
|
|
161
159
|
@connection_pool.with_connection do |zk|
|
162
|
-
zk.create(@path, "", :mode => :ephemeral).
|
160
|
+
expect(zk.create(@path, "", :mode => :ephemeral)).to eq(@path)
|
163
161
|
end
|
164
162
|
|
165
163
|
wait_until(1) { @callback_called }
|
166
164
|
|
167
|
-
@callback_called.
|
165
|
+
expect(@callback_called).to be(true)
|
168
166
|
end
|
169
167
|
|
170
168
|
# These tests are seriously yucky, but they show that when a client is !connected?
|
171
169
|
# the pool behaves properly and will not return that client to the caller.
|
172
|
-
|
170
|
+
|
173
171
|
describe 'health checking with disconnected client', :rbx => :broken do
|
174
172
|
before do
|
175
173
|
wait_until(2) { @connection_pool.available_size == 2 }
|
176
|
-
@connection_pool.available_size.
|
174
|
+
expect(@connection_pool.available_size).to eq(2)
|
177
175
|
|
178
176
|
@connections = @connection_pool.connections
|
179
|
-
@connections.length.
|
177
|
+
expect(@connections.length).to eq(2)
|
180
178
|
|
181
179
|
@cnx1 = @connections.shift
|
182
180
|
|
183
|
-
mock_sub =
|
181
|
+
mock_sub = double(:subscription)
|
184
182
|
|
185
|
-
|
186
|
-
|
187
|
-
m.should_receive(:on_connected).with(Proc).at_least.once.and_return(mock_sub)
|
188
|
-
end
|
183
|
+
expect(@cnx1).to receive(:connected?).at_least(1).and_return(false)
|
184
|
+
expect(@cnx1).to receive(:on_connected).at_least(1).and_yield.and_return(mock_sub)
|
189
185
|
|
190
|
-
@connections.unshift(@
|
186
|
+
@connections.unshift(@cnx1)
|
191
187
|
end
|
192
188
|
|
193
189
|
after do
|
194
|
-
@connections.delete(@mcnx1)
|
195
|
-
@connections.unshift(@cnx1)
|
196
190
|
[@cnx1, @cnx2].each { |c| @connection_pool.checkin(c) }
|
197
191
|
end
|
198
192
|
|
199
193
|
it %[should remove the disconnected client from the pool] do
|
200
|
-
@connection_pool.available_size.
|
194
|
+
expect(@connection_pool.available_size).to eq(2)
|
201
195
|
|
202
196
|
@cnx2 = @connection_pool.checkout
|
203
|
-
|
197
|
+
|
204
198
|
# this is gross and relies on knowing internal state
|
205
|
-
@connection_pool.checkout(false).
|
199
|
+
expect(@connection_pool.checkout(false)).to be(false)
|
206
200
|
|
207
|
-
@cnx2.
|
208
|
-
@cnx2.
|
201
|
+
expect(@cnx2).not_to be_nil
|
202
|
+
expect(@cnx2).not_to eq(@cnx1)
|
209
203
|
|
210
|
-
@connection_pool.available_size.
|
211
|
-
@connections.
|
204
|
+
expect(@connection_pool.available_size).to eq(0)
|
205
|
+
expect(@connections).to include(@cnx1)
|
212
206
|
end
|
213
207
|
end
|
214
208
|
end # Simple
|
@@ -221,18 +215,18 @@ describe ZK::Pool do
|
|
221
215
|
@max_clients = 2
|
222
216
|
@timeout = 10
|
223
217
|
@connection_pool = ZK::Pool::Bounded.new(connection_host, :min_clients => @min_clients, :max_clients => @max_clients, :timeout => @timeout)
|
224
|
-
@connection_pool.
|
218
|
+
expect(@connection_pool).to be_open
|
225
219
|
wait_until(2) { @connection_pool.available_size > 0 }
|
226
220
|
end
|
227
221
|
|
228
222
|
after do
|
229
223
|
@connection_pool.force_close! unless @connection_pool.closed?
|
230
|
-
@connection_pool.
|
224
|
+
expect(@connection_pool).to be_closed
|
231
225
|
end
|
232
226
|
|
233
227
|
describe 'initial state' do
|
234
228
|
it %[should have initialized the minimum number of clients] do
|
235
|
-
@connection_pool.size.
|
229
|
+
expect(@connection_pool.size).to eq(@min_clients)
|
236
230
|
end
|
237
231
|
end
|
238
232
|
|
@@ -248,41 +242,38 @@ describe ZK::Pool do
|
|
248
242
|
|
249
243
|
it %[should grow if it can] do
|
250
244
|
wait_until(2) { @connection_pool.available_size > 0 }
|
251
|
-
@connection_pool.available_size
|
245
|
+
expect(@connection_pool.available_size > 0).to be(true)
|
252
246
|
|
253
|
-
@connection_pool.size.
|
247
|
+
expect(@connection_pool.size).to eq(1)
|
254
248
|
|
255
249
|
logger.debug { "checking out @cnx1" }
|
256
250
|
@cnx1 = @connection_pool.checkout
|
257
|
-
@cnx1.
|
251
|
+
expect(@cnx1).not_to be(false)
|
258
252
|
|
259
|
-
@connection_pool.can_grow_pool
|
253
|
+
expect(@connection_pool.can_grow_pool?).to be(true)
|
260
254
|
|
261
255
|
logger.debug { "checking out @cnx2" }
|
262
256
|
@cnx2 = @connection_pool.checkout
|
263
|
-
@cnx2.
|
264
|
-
@cnx2.
|
257
|
+
expect(@cnx2).not_to be(false)
|
258
|
+
expect(@cnx2).to be_connected
|
265
259
|
|
266
|
-
@cnx1.object_id.
|
260
|
+
expect(@cnx1.object_id).not_to eq(@cnx2.object_id)
|
267
261
|
|
268
262
|
[@cnx1, @cnx2].each { |c| @connection_pool.checkin(c) }
|
269
263
|
end
|
270
264
|
|
271
265
|
it %[should not grow past max_clients and block] do
|
272
|
-
win_q = Queue.new
|
273
266
|
lose_q = Queue.new
|
274
267
|
|
275
|
-
threads = []
|
276
|
-
|
277
268
|
@cnx1 = @connection_pool.checkout
|
278
|
-
@cnx1.
|
269
|
+
expect(@cnx1).not_to be(false)
|
279
270
|
|
280
|
-
@connection_pool.can_grow_pool
|
271
|
+
expect(@connection_pool.can_grow_pool?).to be(true)
|
281
272
|
|
282
273
|
@cnx2 = @connection_pool.checkout
|
283
|
-
@cnx2.
|
274
|
+
expect(@cnx2).not_to be(false)
|
284
275
|
|
285
|
-
@connection_pool.can_grow_pool
|
276
|
+
expect(@connection_pool.can_grow_pool?).to be(false)
|
286
277
|
|
287
278
|
logger.debug { "spawning losing thread" }
|
288
279
|
|
@@ -299,22 +290,22 @@ describe ZK::Pool do
|
|
299
290
|
# logger.debug { "count waiters: #{@connection_pool.count_waiters}" }
|
300
291
|
# @connection_pool.count_waiters.should == 1
|
301
292
|
|
302
|
-
loser[:cnx].
|
293
|
+
expect(loser[:cnx]).to be_nil
|
303
294
|
|
304
295
|
[@cnx1, @cnx2].each { |c| @connection_pool.checkin(c) }
|
305
296
|
|
306
297
|
loser.join_until(2) { loser[:cnx] }
|
307
|
-
loser[:cnx].
|
298
|
+
expect(loser[:cnx]).not_to be_nil
|
308
299
|
|
309
300
|
lose_q.enq(:release)
|
310
301
|
|
311
|
-
|
302
|
+
expect { expect(loser.join(2)).to eq(loser) }.not_to raise_error
|
312
303
|
|
313
304
|
logger.debug { "joined losing thread" }
|
314
305
|
|
315
|
-
@connection_pool.count_waiters.
|
316
|
-
@connection_pool.available_size.
|
317
|
-
@connection_pool.size.
|
306
|
+
expect(@connection_pool.count_waiters).to be_zero
|
307
|
+
expect(@connection_pool.available_size).to eq(2)
|
308
|
+
expect(@connection_pool.size).to eq(2)
|
318
309
|
end
|
319
310
|
end # should grow to max_clients
|
320
311
|
|
@@ -17,11 +17,11 @@ describe ZK::ThreadedCallback do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
after do
|
20
|
-
@tcb.shutdown.
|
20
|
+
expect(@tcb.shutdown).to be(true)
|
21
21
|
end
|
22
22
|
|
23
23
|
it %[should have started the thread] do
|
24
|
-
@tcb.
|
24
|
+
expect(@tcb).to be_alive
|
25
25
|
end
|
26
26
|
|
27
27
|
describe %[pausing for fork] do
|
@@ -31,19 +31,19 @@ describe ZK::ThreadedCallback do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it %[should stop the thread] do
|
34
|
-
@tcb.
|
34
|
+
expect(@tcb).not_to be_alive
|
35
35
|
end
|
36
36
|
|
37
37
|
it %[should allow calls] do
|
38
|
-
|
38
|
+
expect { @tcb.call(:a) }.not_to raise_error
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
describe %[when not running] do
|
43
43
|
it %[should barf with InvalidStateError] do
|
44
|
-
@tcb.shutdown.
|
45
|
-
@tcb.
|
46
|
-
|
44
|
+
expect(@tcb.shutdown).to be(true)
|
45
|
+
expect(@tcb).not_to be_alive
|
46
|
+
expect { @tcb.pause_before_fork_in_parent }.to raise_error(ZK::Exceptions::InvalidStateError)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -52,7 +52,7 @@ describe ZK::ThreadedCallback do
|
|
52
52
|
describe %[after pause] do
|
53
53
|
before do
|
54
54
|
@tcb.pause_before_fork_in_parent
|
55
|
-
@tcb.
|
55
|
+
expect(@tcb).not_to be_alive
|
56
56
|
end
|
57
57
|
|
58
58
|
it %[should deliver any calls on resume] do
|
@@ -65,13 +65,13 @@ describe ZK::ThreadedCallback do
|
|
65
65
|
|
66
66
|
wait_until { @called.length >= 2 }
|
67
67
|
|
68
|
-
@called.length.
|
68
|
+
expect(@called.length).to be >= 2
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
72
|
describe %[if not paused] do
|
73
73
|
it %[should barf with InvalidStateError] do
|
74
|
-
|
74
|
+
expect { @tcb.resume_after_fork_in_parent }.to raise_error(ZK::Exceptions::InvalidStateError)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
data/spec/zk/threadpool_spec.rb
CHANGED
@@ -11,11 +11,11 @@ describe ZK::Threadpool do
|
|
11
11
|
|
12
12
|
describe :new do
|
13
13
|
it %[should be running] do
|
14
|
-
@threadpool.
|
14
|
+
expect(@threadpool).to be_running
|
15
15
|
end
|
16
16
|
|
17
17
|
it %[should use the default size] do
|
18
|
-
@threadpool.size.
|
18
|
+
expect(@threadpool.size).to eq(ZK::Threadpool.default_size)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -27,19 +27,19 @@ describe ZK::Threadpool do
|
|
27
27
|
|
28
28
|
wait_until(2) { @th }
|
29
29
|
|
30
|
-
@th.
|
30
|
+
expect(@th).not_to eq(Thread.current)
|
31
31
|
end
|
32
32
|
|
33
33
|
it %[should barf if the argument is not callable] do
|
34
|
-
bad_obj =
|
35
|
-
bad_obj.
|
34
|
+
bad_obj = double(:not_callable)
|
35
|
+
expect(bad_obj).not_to respond_to(:call)
|
36
36
|
|
37
|
-
|
37
|
+
expect { @threadpool.defer(bad_obj) }.to raise_error(ArgumentError)
|
38
38
|
end
|
39
39
|
|
40
40
|
it %[should not barf if the threadpool is not running] do
|
41
41
|
@threadpool.shutdown
|
42
|
-
|
42
|
+
expect { @threadpool.defer { "hai!" } }.not_to raise_error
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -48,42 +48,42 @@ describe ZK::Threadpool do
|
|
48
48
|
@ary = []
|
49
49
|
|
50
50
|
@threadpool.on_exception { |exc| @ary << exc }
|
51
|
-
|
51
|
+
|
52
52
|
@threadpool.defer { raise "ZOMG!" }
|
53
53
|
|
54
54
|
wait_while(2) { @ary.empty? }
|
55
55
|
|
56
|
-
@ary.length.
|
56
|
+
expect(@ary.length).to eq(1)
|
57
57
|
|
58
58
|
e = @ary.shift
|
59
59
|
|
60
|
-
e.
|
61
|
-
e.message.
|
60
|
+
expect(e).to be_kind_of(RuntimeError)
|
61
|
+
expect(e.message).to eq('ZOMG!')
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
describe :shutdown do
|
66
66
|
it %[should set running to false] do
|
67
67
|
@threadpool.shutdown
|
68
|
-
@threadpool.
|
68
|
+
expect(@threadpool).not_to be_running
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
72
|
describe :start! do
|
73
73
|
it %[should be able to start a threadpool that had previously been shutdown (reuse)] do
|
74
74
|
@threadpool.shutdown
|
75
|
-
@threadpool.start
|
75
|
+
expect(@threadpool.start!).to be(true)
|
76
76
|
|
77
|
-
@threadpool.
|
77
|
+
expect(@threadpool).to be_running
|
78
78
|
|
79
79
|
@rval = nil
|
80
80
|
|
81
|
-
@threadpool.defer do
|
81
|
+
@threadpool.defer do
|
82
82
|
@rval = true
|
83
83
|
end
|
84
84
|
|
85
85
|
wait_until(2) { @rval }
|
86
|
-
@rval.
|
86
|
+
expect(@rval).to be(true)
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -93,24 +93,24 @@ describe ZK::Threadpool do
|
|
93
93
|
@threadpool.defer { @a << @threadpool.on_threadpool? }
|
94
94
|
|
95
95
|
wait_while(2) { @a.empty? }
|
96
|
-
@a.
|
96
|
+
expect(@a).not_to be_empty
|
97
97
|
|
98
|
-
@a.first.
|
98
|
+
expect(@a.first).to be(true)
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
102
|
describe :pause_before_fork_in_parent do
|
103
103
|
it %[should stop all running threads] do
|
104
|
-
@threadpool.
|
105
|
-
@threadpool.
|
104
|
+
expect(@threadpool).to be_running
|
105
|
+
expect(@threadpool).to be_alive
|
106
106
|
@threadpool.pause_before_fork_in_parent
|
107
107
|
|
108
|
-
@threadpool.
|
108
|
+
expect(@threadpool).not_to be_alive
|
109
109
|
end
|
110
110
|
|
111
111
|
it %[should raise InvalidStateError if already paused] do
|
112
112
|
@threadpool.pause_before_fork_in_parent
|
113
|
-
|
113
|
+
expect { @threadpool.pause_before_fork_in_parent }.to raise_error(ZK::Exceptions::InvalidStateError)
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
@@ -121,12 +121,12 @@ describe ZK::Threadpool do
|
|
121
121
|
|
122
122
|
it %[should start all threads running again] do
|
123
123
|
@threadpool.resume_after_fork_in_parent
|
124
|
-
@threadpool.
|
124
|
+
expect(@threadpool).to be_alive
|
125
125
|
end
|
126
126
|
|
127
127
|
it %[should raise InvalidStateError if not in paused state] do
|
128
128
|
@threadpool.shutdown
|
129
|
-
|
129
|
+
expect { @threadpool.resume_after_fork_in_parent }.to raise_error(ZK::Exceptions::InvalidStateError)
|
130
130
|
end
|
131
131
|
|
132
132
|
it %[should run callbacks deferred while paused] do
|
@@ -147,7 +147,7 @@ describe ZK::Threadpool do
|
|
147
147
|
|
148
148
|
latch.await(2)
|
149
149
|
|
150
|
-
calls.
|
150
|
+
expect(calls).not_to be_empty
|
151
151
|
end
|
152
152
|
end
|
153
153
|
end
|