From 3ecb055edad96bbef1c1e5a203e7ffef398005de Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Tue, 11 Mar 2025 11:05:02 -0400 Subject: [PATCH] Fix bug in the `RabbitAmqpListenerTests` for `consumeIsDone` The logic if the `processQ1AndQ2Data()` listener method is to collect 10 messages, where one of them is a duplication after `requeue`. The first `discard` is accepted into `received` result, but the second is terminated by the exception. However, `countDown()` in the `finally` block is still called for all the cases. Therefore, `11` times: 7 for normal data, 1 for `discard`, 2 for `requeue`, and 1 for exception. --- .../amqp/rabbitmq/client/listener/RabbitAmqpListenerTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-rabbitmq-client/src/test/java/org/springframework/amqp/rabbitmq/client/listener/RabbitAmqpListenerTests.java b/spring-rabbitmq-client/src/test/java/org/springframework/amqp/rabbitmq/client/listener/RabbitAmqpListenerTests.java index 816756fd..7d286157 100644 --- a/spring-rabbitmq-client/src/test/java/org/springframework/amqp/rabbitmq/client/listener/RabbitAmqpListenerTests.java +++ b/spring-rabbitmq-client/src/test/java/org/springframework/amqp/rabbitmq/client/listener/RabbitAmqpListenerTests.java @@ -170,7 +170,7 @@ class RabbitAmqpListenerTests extends RabbitAmqpTestBase { final List received = Collections.synchronizedList(new ArrayList<>()); - CountDownLatch consumeIsDone = new CountDownLatch(10); + CountDownLatch consumeIsDone = new CountDownLatch(11); @RabbitListener(queues = {"q1", "q2"}, ackMode = "#{T(org.springframework.amqp.core.AcknowledgeMode).MANUAL}",