Skip to content

Commit 9bb9ccd

Browse files
committed
Add info for test expectation
Test is flaky on CI.
1 parent 4a5cd6a commit 9bb9ccd

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/test/java/com/rabbitmq/stream/impl/SuperStreamConsumerTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import static com.rabbitmq.stream.impl.TestUtils.latchAssert;
2121
import static com.rabbitmq.stream.impl.TestUtils.waitAtMost;
2222
import static com.rabbitmq.stream.impl.TestUtils.wrap;
23+
import static java.lang.String.format;
2324
import static org.assertj.core.api.Assertions.assertThat;
2425

2526
import com.rabbitmq.client.Connection;
@@ -254,10 +255,7 @@ void autoOffsetTrackingShouldStoreOffsetZero() throws Exception {
254255
publishToPartitions(cf, partitions, messageCount);
255256
ConcurrentMap<String, AtomicInteger> messagesReceived = new ConcurrentHashMap<>(partitionCount);
256257
ConcurrentMap<String, Long> lastOffsets = new ConcurrentHashMap<>(partitionCount);
257-
partitions.forEach(
258-
p -> {
259-
messagesReceived.put(p, new AtomicInteger(0));
260-
});
258+
partitions.forEach(p -> messagesReceived.put(p, new AtomicInteger(0)));
261259
CountDownLatch consumeLatch = new CountDownLatch(messageCount);
262260
String consumerName = "my-app";
263261
AtomicInteger totalCount = new AtomicInteger();
@@ -294,9 +292,12 @@ void autoOffsetTrackingShouldStoreOffsetZero() throws Exception {
294292
waitAtMost(
295293
() -> {
296294
QueryOffsetResponse response = client.queryOffset(consumerName, p);
297-
return response.isOk()
298-
&& response.getOffset() == lastOffsets.get(p).longValue();
299-
});
295+
return response.isOk() && response.getOffset() == lastOffsets.get(p);
296+
},
297+
() ->
298+
format(
299+
"Expecting stored offset %d on stream '%s', but got %d",
300+
lastOffsets.get(p), p, client.queryOffset(consumerName, p).getOffset()));
300301
}));
301302
}
302303

0 commit comments

Comments
 (0)