Skip to content

Commit 9146e56

Browse files
committed
Avoid race condition in puma plugin test between restart and termination
If the restart is too slow, we might process the jobs with the initial run of puma instead of the restarted process, and then when we try to terminate it in teardown, we fail.
1 parent cf43054 commit 9146e56

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/integration/puma/plugin_test.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class PumaPluginTest < ActiveSupport::TestCase
4141

4242
test "stop the queue on puma's restart" do
4343
signal_process(@pid, :SIGUSR2)
44-
44+
# Ensure the restart finishes before we try to continue with the test
45+
wait_for_registered_processes(0, timeout: 3.second)
4546
wait_for_registered_processes(4, timeout: 3.second)
4647

4748
StoreResultJob.perform_later(:puma_plugin)

0 commit comments

Comments
 (0)