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/src/test/java/smoketest/pulsar
spring-boot-smoke-test-pulsar-reactive/src/test/java/smoketest/pulsar/reactive Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 37
37
@ Testcontainers (disabledWithoutDocker = true )
38
38
class SampleReactivePulsarApplicationTests {
39
39
40
+ private static final Integer [] EXPECTED_IDS = IntStream .range (0 , 10 ).boxed ().toArray (Integer []::new );
41
+
40
42
@ Container
41
43
private static final PulsarContainer PULSAR_CONTAINER = new PulsarContainer (DockerImageNames .pulsar ())
42
44
.withStartupAttempts (2 )
@@ -50,11 +52,15 @@ static void pulsarProperties(DynamicPropertyRegistry registry) {
50
52
51
53
@ Test
52
54
void appProducesAndConsumesSampleMessages (@ Autowired SampleMessageConsumer consumer ) {
53
- Integer [] expectedIds = IntStream .range (0 , 10 ).boxed ().toArray (Integer []::new );
54
55
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 );
58
64
}
59
65
60
66
}
Original file line number Diff line number Diff line change 37
37
@ Testcontainers (disabledWithoutDocker = true )
38
38
class SamplePulsarApplicationTests {
39
39
40
+ private static final Integer [] EXPECTED_IDS = IntStream .range (0 , 10 ).boxed ().toArray (Integer []::new );
41
+
40
42
@ Container
41
43
private static final PulsarContainer PULSAR_CONTAINER = new PulsarContainer (DockerImageNames .pulsar ())
42
44
.withStartupAttempts (2 )
@@ -50,11 +52,15 @@ static void pulsarProperties(DynamicPropertyRegistry registry) {
50
52
51
53
@ Test
52
54
void appProducesAndConsumesSampleMessages (@ Autowired SampleMessageConsumer consumer ) {
53
- Integer [] expectedIds = IntStream .range (0 , 10 ).boxed ().toArray (Integer []::new );
54
55
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 );
58
64
}
59
65
60
66
}
You can’t perform that action at this time.
0 commit comments