Fix race condition in ProcessRunnerTests

There's a race between destruction of the process completing and the
test checking that the process has been destroyed. When the test
wins the race, it fails.

This commit removes the race condition by updating the test to wait
until the process has been destroyed.

Closes gh-51571
This commit is contained in:
Andy Wilkinson
2026-09-04 08:40:35 +01:00
parent 4b9b4c6fd9
commit 10190c7cc7
@@ -84,7 +84,7 @@ class ProcessRunnerTests {
runner.join(Duration.ofSeconds(5).toMillis());
assertThat(runner.isAlive()).isFalse();
assertThat(error.get()).isInstanceOf(IllegalStateException.class);
assertThat(ProcessHandle.of(pid).map(ProcessHandle::isAlive).orElse(false)).isFalse();
Awaitility.await().until(() -> !ProcessHandle.of(pid).map(ProcessHandle::isAlive).orElse(false));
}
@Nested