|
30 | 30 | import com.rabbitmq.client.test.BrokerTestCase; |
31 | 31 | import com.rabbitmq.client.test.TestUtils; |
32 | 32 | import com.rabbitmq.tools.Host; |
33 | | -import java.util.UUID; |
34 | 33 | import org.junit.jupiter.api.Test; |
35 | 34 |
|
36 | 35 | import java.io.IOException; |
@@ -313,17 +312,20 @@ public void multiThreadedMetricsStandardConnection(ConnectionFactory connectionF |
313 | 312 | } |
314 | 313 |
|
315 | 314 |
|
316 | | - List<Callable<Void>> tasks = new ArrayList<Callable<Void>>(); |
| 315 | + List<Callable<Void>> tasks = new ArrayList<>(); |
317 | 316 | for(int i = 0; i < nbTasks; i++) { |
318 | 317 | Channel channelForConsuming = channels[random.nextInt(nbChannels)]; |
319 | | - tasks.add(random.nextInt(10)%2 == 0 ? |
| 318 | + tasks.add(random.nextInt(10) % 2 == 0 ? |
320 | 319 | new BasicGetTask(channelForConsuming, true) : |
321 | 320 | new BasicConsumeTask(channelForConsuming, true)); |
322 | 321 | } |
323 | 322 | executorService.invokeAll(tasks); |
324 | 323 |
|
| 324 | + waitAtMost(timeout(), () -> metrics.getPublishedMessages().getCount() == nbOfMessages, |
| 325 | + () -> "expecting " + nbOfMessages + " published message(s), got " + metrics.getPublishedMessages().getCount()); |
325 | 326 | assertThat(metrics.getPublishedMessages().getCount()).isEqualTo(nbOfMessages); |
326 | | - waitAtMost(timeout(), () -> metrics.getConsumedMessages().getCount() == nbOfMessages); |
| 327 | + waitAtMost(timeout(), () -> metrics.getConsumedMessages().getCount() == nbOfMessages, |
| 328 | + () -> "expecting " + nbOfMessages + " consumed message(s), got " + metrics.getConsumedMessages().getCount()); |
327 | 329 | assertThat(metrics.getAcknowledgedMessages().getCount()).isEqualTo(0L); |
328 | 330 |
|
329 | 331 | // to remove the listeners |
@@ -635,7 +637,7 @@ private void sendMessage(Channel channel) throws IOException { |
635 | 637 | } |
636 | 638 |
|
637 | 639 | private Duration timeout() { |
638 | | - return Duration.ofSeconds(10); |
| 640 | + return Duration.ofSeconds(20); |
639 | 641 | } |
640 | 642 |
|
641 | 643 | private static class MultipleAckConsumer extends DefaultConsumer { |
|
0 commit comments