Skip to content

Commit dcc9354

Browse files
committed
Add diagnostics for flaky test
1 parent df90345 commit dcc9354

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

spring-rabbit/src/test/java/org/springframework/amqp/rabbit/core/RabbitTemplatePublisherCallbacksIntegrationTests3.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory.ConfirmType;
3131
import org.springframework.amqp.rabbit.connection.Connection;
3232
import org.springframework.amqp.rabbit.connection.CorrelationData;
33+
import org.springframework.amqp.rabbit.junit.LogLevels;
3334
import org.springframework.amqp.rabbit.junit.RabbitAvailable;
3435
import org.springframework.amqp.rabbit.junit.RabbitAvailableCondition;
3536
import org.springframework.amqp.utils.test.TestUtils;
@@ -70,6 +71,7 @@ public void testRepublishOnNackThreadNoExchange() throws Exception {
7071
assertThat(template.receive(QUEUE1, 10_000)).isNotNull();
7172
}
7273

74+
@LogLevels(categories = "org.springframework.amqp.rabbit")
7375
@Test
7476
public void testDeferredChannelCacheNack() throws Exception {
7577
final CachingConnectionFactory cf = new CachingConnectionFactory(
@@ -100,10 +102,6 @@ public void testDeferredChannelCacheNack() throws Exception {
100102
template.convertAndSend("", QUEUE2 + "junk", "foo", new MyCD("foo"));
101103
assertThat(returnLatch.await(10, TimeUnit.SECONDS)).isTrue();
102104
assertThat(confirmLatch.await(10, TimeUnit.SECONDS)).isTrue();
103-
int n = 0;
104-
while (n++ < 100 && cacheCount.get() != 1) {
105-
Thread.sleep(100);
106-
}
107105
assertThat(cacheCount.get()).isEqualTo(1);
108106
assertThat(returnCalledFirst.get()).isTrue();
109107
cf.destroy();

0 commit comments

Comments
 (0)