Skip to content

Commit 2ebcdb0

Browse files
committed
Tweak Pulsar smoke test timeouts
See gh-34763
1 parent 975cb27 commit 2ebcdb0

File tree

2 files changed

+20
-8
lines changed

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/SampleReactivePulsarApplicationTests.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
@Testcontainers(disabledWithoutDocker = true)
3838
class 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
}

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-pulsar/src/test/java/smoketest/pulsar/SamplePulsarApplicationTests.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
@Testcontainers(disabledWithoutDocker = true)
3838
class 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
}

0 commit comments

Comments
 (0)