ruby-changes:72803
From: Jean <ko1@a...>
Date: Wed, 3 Aug 2022 17:59:36 +0900 (JST)
Subject: [ruby-changes:72803] 4406cb1bf1 (master): Harden Queue#pop timeout tests
https://git.ruby-lang.org/ruby.git/commit/?id=4406cb1bf1 From 4406cb1bf10e34757d9877b3b12d4b0c294c22fb Mon Sep 17 00:00:00 2001 From: Jean Boussier <jean.boussier@g...> Date: Wed, 3 Aug 2022 09:46:21 +0200 Subject: 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. --- test/ruby/test_thread_queue.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/ruby/test_thread_queue.rb b/test/ruby/test_thread_queue.rb index aa4ea0a400..1c852474b4 100644 --- a/test/ruby/test_thread_queue.rb +++ b/test/ruby/test_thread_queue.rb @@ -121,11 +121,11 @@ class TestThreadQueue < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread_queue.rb#L121 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_thread_queue.rb#L154 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 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/