Skip to content

Commit

Permalink
Increase await() timeout for 30 seconds in MQTT tests
Browse files Browse the repository at this point in the history
**Auto-cherry-pick to `6.3.x` & `6.2.x`**
  • Loading branch information
artembilan committed Nov 4, 2024
1 parent 3dab443 commit 846d655
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.springframework.integration.mqtt;

import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
Expand Down Expand Up @@ -124,7 +125,7 @@ private void testSubscribeAndPublish(Class<?> configClass, String topicName, Cou
if (ctx.containsBean("deliveryEvents")) {
List<MqttMessageDeliveryEvent> deliveryEvents = ctx.getBean("deliveryEvents", List.class);
// MqttMessageSentEvent and MqttMessageDeliveredEvent
await().untilAsserted(() -> assertThat(deliveryEvents).hasSize(2));
await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> assertThat(deliveryEvents).hasSize(2));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 the original author or authors.
* Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,7 @@

package org.springframework.integration.mqtt;

import java.time.Duration;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

Expand Down Expand Up @@ -82,7 +83,7 @@ void messageReceivedAfterResubscriptionOnLostConnection() throws InterruptedExce

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

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

// Re-subscription on channel adapter restart with cleanStart
Expand Down

0 comments on commit 846d655

Please sign in to comment.