mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
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:
+1
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user