From 10190c7cc79420addb847eac7de801caa4356824 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 4 Sep 2026 08:40:35 +0100 Subject: [PATCH] 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 --- .../boot/docker/compose/core/ProcessRunnerTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/core/ProcessRunnerTests.java b/core/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/core/ProcessRunnerTests.java index 370bb88551c..51b8af17e23 100644 --- a/core/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/core/ProcessRunnerTests.java +++ b/core/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/core/ProcessRunnerTests.java @@ -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