|
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; |
@@ -318,17 +317,20 @@ public void multiThreadedMetricsStandardConnection(ConnectionFactory connectionF |
318 | 317 | } |
319 | 318 |
|
320 | 319 |
|
321 | | - List<Callable<Void>> tasks = new ArrayList<Callable<Void>>(); |
| 320 | + List<Callable<Void>> tasks = new ArrayList<>(); |
322 | 321 | for(int i = 0; i < nbTasks; i++) { |
323 | 322 | Channel channelForConsuming = channels[random.nextInt(nbChannels)]; |
324 | | - tasks.add(random.nextInt(10)%2 == 0 ? |
| 323 | + tasks.add(random.nextInt(10) % 2 == 0 ? |
325 | 324 | new BasicGetTask(channelForConsuming, true) : |
326 | 325 | new BasicConsumeTask(channelForConsuming, true)); |
327 | 326 | } |
328 | 327 | executorService.invokeAll(tasks); |
329 | 328 |
|
| 329 | + waitAtMost(timeout(), () -> metrics.getPublishedMessages().getCount() == nbOfMessages, |
| 330 | + () -> "expecting " + nbOfMessages + " published message(s), got " + metrics.getPublishedMessages().getCount()); |
330 | 331 | assertThat(metrics.getPublishedMessages().getCount()).isEqualTo(nbOfMessages); |
331 | | - waitAtMost(timeout(), () -> metrics.getConsumedMessages().getCount() == nbOfMessages); |
| 332 | + waitAtMost(timeout(), () -> metrics.getConsumedMessages().getCount() == nbOfMessages, |
| 333 | + () -> "expecting " + nbOfMessages + " consumed message(s), got " + metrics.getConsumedMessages().getCount()); |
332 | 334 | assertThat(metrics.getAcknowledgedMessages().getCount()).isEqualTo(0L); |
333 | 335 |
|
334 | 336 | // to remove the listeners |
@@ -640,7 +642,7 @@ private void sendMessage(Channel channel) throws IOException { |
640 | 642 | } |
641 | 643 |
|
642 | 644 | private Duration timeout() { |
643 | | - return Duration.ofSeconds(10); |
| 645 | + return Duration.ofSeconds(20); |
644 | 646 | } |
645 | 647 |
|
646 | 648 | private static class MultipleAckConsumer extends DefaultConsumer { |
|
0 commit comments