Skip to content

Commit dac9c89

Browse files
committed
Refactored problematic RubyFixedThreadPool specs.
1 parent 942e67f commit dac9c89

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

spec/concurrent/executor/fixed_thread_pool_shared.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,14 @@
182182

183183
context 'overflow policy' do
184184

185-
before do
185+
before(:each) do
186186
@queue = Queue.new
187187
end
188188

189+
after(:each) do
190+
subject.kill
191+
end
192+
189193
# On abort, it should raise an error
190194
it "raises an error when overflow on abort" do
191195
latch = Concurrent::CountDownLatch.new(5)
@@ -200,7 +204,6 @@
200204
latch.count_down
201205
end
202206
end
203-
subject.shutdown
204207
latch.wait(1)
205208
}.to raise_error
206209
end
@@ -218,7 +221,6 @@
218221
latch.count_down
219222
end
220223
end
221-
subject.shutdown
222224
latch.wait(1)
223225

224226
@queue.length.should be < 5
@@ -227,7 +229,7 @@
227229
# To check for caller_runs, we'll check how many unique threads
228230
# actually ran the block
229231

230-
it 'uses the calling thread for overflow under caller_runs', :brittle do
232+
it 'uses the calling thread for overflow under caller_runs' do
231233
latch = Concurrent::CountDownLatch.new(5)
232234
mutex = Mutex.new
233235

@@ -240,7 +242,6 @@
240242
latch.count_down
241243
end
242244
end
243-
subject.shutdown
244245
latch.wait(1)
245246

246247
# Turn the queue into an array

0 commit comments

Comments
 (0)