Skip to content

Commit fcbb0ca

Browse files
committed
Increate timeout for recovery in test
1 parent 8ba9c50 commit fcbb0ca

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/test/java/com/rabbitmq/client/amqp/impl/RecoveryClusterTest.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class RecoveryClusterTest {
4646
static final BackOffDelayPolicy BACK_OFF_DELAY_POLICY = BackOffDelayPolicy.fixed(ofSeconds(1));
4747
static List<String> nodes;
4848
Environment environment;
49-
Connection connection;
49+
AmqpConnection connection;
5050
Management management;
5151
TestInfo testInfo;
5252

@@ -60,12 +60,13 @@ void init(TestInfo info) {
6060
environment =
6161
new AmqpEnvironmentBuilder().connectionSettings().uris(URIS).environmentBuilder().build();
6262
this.connection =
63-
environment
64-
.connectionBuilder()
65-
.recovery()
66-
.backOffDelayPolicy(BACK_OFF_DELAY_POLICY)
67-
.connectionBuilder()
68-
.build();
63+
(AmqpConnection)
64+
environment
65+
.connectionBuilder()
66+
.recovery()
67+
.backOffDelayPolicy(BACK_OFF_DELAY_POLICY)
68+
.connectionBuilder()
69+
.build();
6970
this.management = connection.management();
7071
this.testInfo = info;
7172
}
@@ -112,9 +113,12 @@ void clusterRestart() {
112113
nodes.forEach(Cli::restartNode);
113114
Cli.rebalance();
114115

116+
waitAtMost(() -> connection.state() == Resource.State.OPEN);
117+
115118
qqNames.stream()
116119
.parallel()
117-
.forEach(n -> waitAtMostNoException(() -> management.queueInfo(n)));
120+
.forEach(
121+
n -> waitAtMostNoException(TIMEOUT.multipliedBy(2), () -> management.queueInfo(n)));
118122
qqNames.stream()
119123
.parallel()
120124
.forEach(

src/test/java/com/rabbitmq/client/amqp/impl/TestUtils.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,12 @@ interface RunnableWithException {
9191
}
9292

9393
public static Duration waitAtMostNoException(RunnableWithException condition) {
94+
return waitAtMostNoException(DEFAULT_CONDITION_TIMEOUT, condition);
95+
}
96+
97+
public static Duration waitAtMostNoException(Duration timeout, RunnableWithException condition) {
9498
return waitAtMost(
95-
DEFAULT_CONDITION_TIMEOUT,
99+
timeout,
96100
() -> {
97101
try {
98102
condition.run();

0 commit comments

Comments
 (0)