Skip to content

Commit 6af1316

Browse files
committed
Fixed brittle thread pool (:discard) tests.
1 parent 29cd69a commit 6af1316

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

spec/concurrent/executor/thread_pool_executor_shared.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,25 +255,25 @@
255255
specify 'a #post task is never executed when the queue is at capacity' do
256256
executed = Concurrent::AtomicFixnum.new(0)
257257
1000.times do
258-
subject.post{ executed.increment }
258+
subject.post{ sleep; executed.increment }
259259
end
260260
sleep(0.1)
261-
expect(executed.value).to be < 1000
261+
expect(executed.value).to be 0
262262
end
263263

264264
specify 'a #<< task is never executed when the queue is at capacity' do
265265
executed = Concurrent::AtomicFixnum.new(0)
266266
1000.times do
267-
subject << proc { executed.increment }
267+
subject << proc { sleep; executed.increment }
268268
end
269269
sleep(0.1)
270-
expect(executed.value).to be < 1000
270+
expect(executed.value).to be 0
271271
end
272272

273273
specify 'a #post task is never executed when the executor is shutting down' do
274274
executed = Concurrent::AtomicFixnum.new(0)
275275
subject.shutdown
276-
subject.post{ executed.increment }
276+
subject.post{ sleep; executed.increment }
277277
sleep(0.1)
278278
expect(executed.value).to be 0
279279
end

0 commit comments

Comments
 (0)