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
This commit is contained in:
abilan
2023-05-08 11:19:54 -04:00
parent ffe50d2d30
commit 32b6d823c0

View File

@@ -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