Skip to content

Commit 94865de

Browse files
committed
(MODULES-7033) Fix Process Kill Test
This change fixes a spec test that was giving unreliable results and erroneously failing CI pipelines.
1 parent a7a7b25 commit 94865de

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

spec/integration/puppet_x/puppetlabs/powershell_manager_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ def create_manager()
6666
expected_error = /Failure waiting for PowerShell process (\d+) to start pipe server/
6767
expect(e.message).to match expected_error
6868
pid = expected_error.match(e.message)[1].to_i
69+
70+
# We want to make sure that enough time has elapsed since the manager called kill
71+
# for the OS to finish killing the process and doing all of it's cleanup.
72+
# We have found that without an appropriate wait period, the kill call below
73+
# can return unexpected results and fail the test.
74+
sleep(1)
6975
expect{Process.kill(0, pid)}.to raise_error(Errno::ESRCH)
7076
end
7177
end

0 commit comments

Comments
 (0)