mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Harden Queue#pop timeout tests
They occasionaly fail with; ``` FLeaked thread: TestThreadQueue#test_queue_pop_timeout: #<Thread:0x0000000108e38e48 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:123 sleep> .Finished thread: TestThreadQueue#test_deny_pushers: #<Thread:0x0000000108e38e48 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:123 dead> ... Retrying... 1) Failure: TestThreadQueue#test_sized_queue_pop_timeout [/Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:157]: <#<Thread:0x00000001084bc7e8 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:156 sleep>> expected but was <nil>. 2) Failure: TestThreadQueue#test_queue_pop_timeout [/Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:124]: <#<Thread:0x00000001083ff058 /Users/runner/work/ruby/ruby/src/test/ruby/test_thread_queue.rb:123 sleep>> expected but was <nil>. ``` I'm hoping joining for longer should help avoid this.
This commit is contained in:
parent
851b3aa7dd
commit
4406cb1bf1
Notes:
git
2022-08-03 17:59:42 +09:00
1 changed files with 6 additions and 6 deletions
|
@ -121,11 +121,11 @@ class TestThreadQueue < Test::Unit::TestCase
|
|||
assert_nil t1.value
|
||||
|
||||
t2 = Thread.new { q.pop(timeout: 0.1) }
|
||||
assert_equal t2, t2.join(0.2)
|
||||
assert_equal t2, t2.join(1)
|
||||
assert_nil t2.value
|
||||
ensure
|
||||
t1&.kill
|
||||
t2&.kill
|
||||
t1&.kill&.join
|
||||
t2&.kill&.join
|
||||
end
|
||||
|
||||
def test_queue_pop_non_block
|
||||
|
@ -154,11 +154,11 @@ class TestThreadQueue < Test::Unit::TestCase
|
|||
assert_nil t1.value
|
||||
|
||||
t2 = Thread.new { q.pop(timeout: 0.1) }
|
||||
assert_equal t2, t2.join(0.2)
|
||||
assert_equal t2, t2.join(1)
|
||||
assert_nil t2.value
|
||||
ensure
|
||||
t1&.kill
|
||||
t2&.kill
|
||||
t1&.kill&.join
|
||||
t2&.kill&.join
|
||||
end
|
||||
|
||||
def test_sized_queue_pop_non_block
|
||||
|
|
Loading…
Add table
Reference in a new issue