Skip to content

Commit

Permalink
Fix race condition in testFluxChannelCleanUp
Browse files Browse the repository at this point in the history
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
  • Loading branch information
artembilan committed May 8, 2023
1 parent ffe50d2 commit 32b6d82
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
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
Expand Down Expand Up @@ -139,7 +140,8 @@ void testFluxMessageChannelCleanUp() throws InterruptedException {

flowRegistration.destroy();

assertThat(TestUtils.getPropertyValue(flux, "sink.sink.done", Boolean.class)).isTrue();
await()
.until(() -> TestUtils.getPropertyValue(flux, "sink.sink.done", Boolean.class));
}

@Configuration
Expand Down

0 comments on commit 32b6d82

Please sign in to comment.