Skip to content

Commit 7071c16

Browse files
committed
Fix wrong calls to wait for registered processes in tests
These were working most of the time by chance, since we'd just wait for the default 1 second timeout and the processes would be there, but sometimes in CI, this wouldn't be the case.
1 parent ebd9b02 commit 7071c16

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/unit/supervisor_test.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class SupervisorTest < ActiveSupport::TestCase
1818

1919
test "start in work mode (default)" do
2020
pid = run_supervisor_as_fork
21-
wait_for_registered_processes(0.3)
21+
wait_for_registered_processes(4)
2222

2323
assert_registered_supervisor(pid)
2424
assert_registered_workers(2, supervisor_pid: pid)
@@ -30,7 +30,7 @@ class SupervisorTest < ActiveSupport::TestCase
3030

3131
test "start in dispatch mode" do
3232
pid = run_supervisor_as_fork(mode: :dispatch)
33-
wait_for_registered_processes(0.3)
33+
wait_for_registered_processes(4)
3434

3535
assert_registered_supervisor(pid)
3636
assert_registered_dispatcher(supervisor_pid: pid)
@@ -44,7 +44,7 @@ class SupervisorTest < ActiveSupport::TestCase
4444
assert_not File.exist?(@pidfile)
4545

4646
pid = run_supervisor_as_fork(mode: :all)
47-
wait_for_registered_processes(0.3)
47+
wait_for_registered_processes(4)
4848

4949
assert File.exist?(@pidfile)
5050
assert_equal pid, File.read(@pidfile).strip.to_i
@@ -59,7 +59,7 @@ class SupervisorTest < ActiveSupport::TestCase
5959
File.write(@pidfile, ::Process.pid.to_s)
6060

6161
pid = run_supervisor_as_fork(mode: :all)
62-
wait_for_registered_processes(0.3)
62+
wait_for_registered_processes(4)
6363

6464
assert File.exist?(@pidfile)
6565
assert_not_equal pid, File.read(@pidfile).strip.to_i
@@ -69,15 +69,17 @@ class SupervisorTest < ActiveSupport::TestCase
6969

7070
test "deletes previous pidfile if the owner is dead" do
7171
pid = run_supervisor_as_fork(mode: :all)
72-
wait_for_registered_processes(0.3)
72+
wait_for_registered_processes(4)
7373

7474
terminate_process(pid, signal: :KILL)
7575

7676
assert File.exist?(@pidfile)
7777
assert_equal pid, File.read(@pidfile).strip.to_i
7878

79+
wait_for_registered_processes(0)
80+
7981
pid = run_supervisor_as_fork(mode: :all)
80-
wait_for_registered_processes(0.3)
82+
wait_for_registered_processes(4)
8183

8284
assert File.exist?(@pidfile)
8385
assert_equal pid, File.read(@pidfile).strip.to_i

0 commit comments

Comments
 (0)