File tree Expand file tree Collapse file tree 2 files changed +20
-8
lines changed
spring-boot-tests/spring-boot-smoke-tests
spring-boot-smoke-test-pulsar-reactive/src/test/java/smoketest/pulsar/reactive
spring-boot-smoke-test-pulsar/src/test/java/smoketest/pulsar Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 3737@ Testcontainers (disabledWithoutDocker = true )
3838class SampleReactivePulsarApplicationTests {
3939
40+ private static final Integer [] EXPECTED_IDS = IntStream .range (0 , 10 ).boxed ().toArray (Integer []::new );
41+
4042 @ Container
4143 private static final PulsarContainer PULSAR_CONTAINER = new PulsarContainer (DockerImageNames .pulsar ())
4244 .withStartupAttempts (2 )
@@ -50,11 +52,15 @@ static void pulsarProperties(DynamicPropertyRegistry registry) {
5052
5153 @ Test
5254 void appProducesAndConsumesSampleMessages (@ Autowired SampleMessageConsumer consumer ) {
53- Integer [] expectedIds = IntStream .range (0 , 10 ).boxed ().toArray (Integer []::new );
5455 Awaitility .await ()
55- .atMost (Duration .ofSeconds (20 ))
56- .untilAsserted (() -> assertThat (consumer .getConsumed ()).extracting (SampleMessage ::id )
57- .containsExactly (expectedIds ));
56+ .atMost (Duration .ofMinutes (3 ))
57+ .with ()
58+ .pollInterval (Duration .ofMillis (500 ))
59+ .untilAsserted (() -> hasExpectedIds (consumer ));
60+ }
61+
62+ private void hasExpectedIds (SampleMessageConsumer consumer ) {
63+ assertThat (consumer .getConsumed ()).extracting (SampleMessage ::id ).containsExactly (EXPECTED_IDS );
5864 }
5965
6066}
Original file line number Diff line number Diff line change 3737@ Testcontainers (disabledWithoutDocker = true )
3838class SamplePulsarApplicationTests {
3939
40+ private static final Integer [] EXPECTED_IDS = IntStream .range (0 , 10 ).boxed ().toArray (Integer []::new );
41+
4042 @ Container
4143 private static final PulsarContainer PULSAR_CONTAINER = new PulsarContainer (DockerImageNames .pulsar ())
4244 .withStartupAttempts (2 )
@@ -50,11 +52,15 @@ static void pulsarProperties(DynamicPropertyRegistry registry) {
5052
5153 @ Test
5254 void appProducesAndConsumesSampleMessages (@ Autowired SampleMessageConsumer consumer ) {
53- Integer [] expectedIds = IntStream .range (0 , 10 ).boxed ().toArray (Integer []::new );
5455 Awaitility .await ()
55- .atMost (Duration .ofSeconds (20 ))
56- .untilAsserted (() -> assertThat (consumer .getConsumed ()).extracting (SampleMessage ::id )
57- .containsExactly (expectedIds ));
56+ .atMost (Duration .ofMinutes (3 ))
57+ .with ()
58+ .pollInterval (Duration .ofMillis (500 ))
59+ .untilAsserted (() -> hasExpectedIds (consumer ));
60+ }
61+
62+ private void hasExpectedIds (SampleMessageConsumer consumer ) {
63+ assertThat (consumer .getConsumed ()).extracting (SampleMessage ::id ).containsExactly (EXPECTED_IDS );
5864 }
5965
6066}
You can’t perform that action at this time.
0 commit comments