From 32b6d823c02cdde91089479369b2f55be335f203 Mon Sep 17 00:00:00 2001 From: abilan Date: Mon, 8 May 2023 11:19:54 -0400 Subject: [PATCH] Fix race condition in testFluxChannelCleanUp Turns out `done` in the `SinkManyEmitterProcessor` is set to `true` when we already processed all the data. Therefore, it is better to `await().until()` for `done` condition in the end of test --- .../integration/channel/reactive/FluxMessageChannelTests.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/reactive/FluxMessageChannelTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/reactive/FluxMessageChannelTests.java index bed97230ba..9fdfb392d5 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/reactive/FluxMessageChannelTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/reactive/FluxMessageChannelTests.java @@ -50,6 +50,7 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import static org.assertj.core.api.Assertions.assertThat; +import static org.awaitility.Awaitility.await; /** * @author Artem Bilan @@ -139,7 +140,8 @@ public class FluxMessageChannelTests { flowRegistration.destroy(); - assertThat(TestUtils.getPropertyValue(flux, "sink.sink.done", Boolean.class)).isTrue(); + await() + .until(() -> TestUtils.getPropertyValue(flux, "sink.sink.done", Boolean.class)); } @Configuration