Skip to content

Commit 846d655

Browse files
committed
Increase await() timeout for 30 seconds in MQTT tests
**Auto-cherry-pick to `6.3.x` & `6.2.x`**
1 parent 3dab443 commit 846d655

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/ClientManagerBackToBackTests.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.integration.mqtt;
1818

1919
import java.nio.charset.StandardCharsets;
20+
import java.time.Duration;
2021
import java.util.ArrayList;
2122
import java.util.List;
2223
import java.util.concurrent.CountDownLatch;
@@ -124,7 +125,7 @@ private void testSubscribeAndPublish(Class<?> configClass, String topicName, Cou
124125
if (ctx.containsBean("deliveryEvents")) {
125126
List<MqttMessageDeliveryEvent> deliveryEvents = ctx.getBean("deliveryEvents", List.class);
126127
// MqttMessageSentEvent and MqttMessageDeliveredEvent
127-
await().untilAsserted(() -> assertThat(deliveryEvents).hasSize(2));
128+
await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> assertThat(deliveryEvents).hasSize(2));
128129
}
129130
}
130131
}

spring-integration-mqtt/src/test/java/org/springframework/integration/mqtt/ResubscribeAfterAutomaticReconnectTests.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 the original author or authors.
2+
* Copyright 2023-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.integration.mqtt;
1818

19+
import java.time.Duration;
1920
import java.util.concurrent.CountDownLatch;
2021
import java.util.concurrent.TimeUnit;
2122

@@ -82,7 +83,7 @@ void messageReceivedAfterResubscriptionOnLostConnection() throws InterruptedExce
8283

8384
assertThat(this.config.subscribeSecondLatch.await(10, TimeUnit.SECONDS)).isTrue();
8485

85-
await().untilAsserted(() -> this.mqttOutFlowInput.send(testMessage));
86+
await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> this.mqttOutFlowInput.send(testMessage));
8687
assertThat(this.fromMqttChannel.receive(10_000)).isNotNull();
8788

8889
// Re-subscription on channel adapter restart with cleanStart

0 commit comments

Comments
 (0)