apupier commented on code in PR #24448:
URL: https://github.com/apache/camel/pull/24448#discussion_r3527479761


##########
components/camel-reactive-streams/src/test/java/org/apache/camel/component/reactive/streams/BackpressureStrategyTest.java:
##########
@@ -145,12 +155,14 @@ public void onNext(Integer o) {
         context().start();
 
         assertTrue(latch.await(5, TimeUnit.SECONDS));
-        Thread.sleep(1000); // wait for all numbers to be generated
+        // Wait for all 20 timer events to be processed
+        await().atMost(5, TimeUnit.SECONDS).until(() -> timerCount.get() >= 
20);
 
         subscriber.request(19);
-        assertTrue(latch2.await(1, TimeUnit.SECONDS));
-        Thread.sleep(200); // add other time to ensure no other items arrive
-        assertEquals(2, queue.size());
+        assertTrue(latch2.await(2, TimeUnit.SECONDS));
+        // Verify exactly 2 items received and no more arrive
+        await().atMost(2, TimeUnit.SECONDS)
+                .untilAsserted(() -> assertEquals(2, queue.size()));

Review Comment:
   this is no more waiting for potential new messages erroneously to arrive



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to