diff --git a/test/integration/processes_lifecycle_test.rb b/test/integration/processes_lifecycle_test.rb index 8ecd8238..55e9ca30 100644 --- a/test/integration/processes_lifecycle_test.rb +++ b/test/integration/processes_lifecycle_test.rb @@ -42,7 +42,7 @@ class ProcessLifecycleTest < ActiveSupport::TestCase puts @pid puts `ps aux | grep #{@pid}` - assert_not process_exists?(@pid) + assert_not process_exists?(@pid, waitpid: true) assert_completed_job_results("no pause") assert_job_status(no_pause, :finished) @@ -70,7 +70,7 @@ class ProcessLifecycleTest < ActiveSupport::TestCase signal_process(@pid, :QUIT, wait: 1.second) wait_for_jobs_to_finish_for(5.seconds) - assert_not process_exists?(@pid) + assert_not process_exists?(@pid, waitpid: true) assert_completed_job_results("no pause") assert_job_status(no_pause, :finished) diff --git a/test/test_helper.rb b/test/test_helper.rb index e73b878b..e9da9825 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -88,7 +88,8 @@ def signal_process(pid, signal, wait: nil, raise_on_missing: true) end end - def process_exists?(pid) + def process_exists?(pid, waitpid: false) + Process.waitpid(pid) if waitpid Process.getpgid(pid) true rescue Errno::ESRCH