Skip to content

Commit 4282382

Browse files
committed
More test logging
1 parent 549eb6f commit 4282382

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919

2020
import static com.rabbitmq.client.amqp.ConnectionSettings.Affinity.Operation.CONSUME;
2121
import static com.rabbitmq.client.amqp.ConnectionSettings.Affinity.Operation.PUBLISH;
22+
import static com.rabbitmq.client.amqp.Resource.State.OPEN;
2223
import static com.rabbitmq.client.amqp.impl.Assertions.assertThat;
2324
import static com.rabbitmq.client.amqp.impl.TestUtils.*;
25+
import static java.lang.String.format;
2426
import static java.time.Duration.ofSeconds;
2527
import static java.util.stream.Collectors.toList;
2628
import static org.assertj.core.api.Assertions.assertThat;
@@ -123,7 +125,9 @@ void clusterRestart() {
123125
Cli.rebalance();
124126
LOGGER.info("Rebalancing over.");
125127

126-
waitAtMost(() -> connection.state() == Resource.State.OPEN);
128+
waitAtMost(
129+
() -> connection.state() == OPEN,
130+
() -> format("Test connection state is %s, expecting %s", connection.state(), OPEN));
127131
LOGGER.info("Test connection has recovered");
128132

129133
qqNames.forEach(
@@ -144,8 +148,8 @@ void clusterRestart() {
144148
syncs.forEach(s -> assertThat(s).completes());
145149
LOGGER.info("Check consumers have recovered.");
146150

147-
assertThat(publisherStates).allMatch(s -> s.state() == Resource.State.OPEN);
148-
assertThat(consumerStates).allMatch(s -> s.state() == Resource.State.OPEN);
151+
assertThat(publisherStates).allMatch(s -> s.state() == OPEN);
152+
assertThat(consumerStates).allMatch(s -> s.state() == OPEN);
149153

150154
System.out.println("Queues:");
151155
qqNames.forEach(
@@ -217,7 +221,7 @@ void start() {
217221
.newThread(
218222
() -> {
219223
while (!stopped.get() && !Thread.currentThread().isInterrupted()) {
220-
if (state.get() == Resource.State.OPEN) {
224+
if (state.get() == OPEN) {
221225
try {
222226
this.limiter.acquire(1);
223227
this.publisher.publish(publisher.message(BODY), callback);

0 commit comments

Comments
 (0)