lhotari commented on code in PR #25590:
URL: https://github.com/apache/pulsar/pull/25590#discussion_r3152212450


##########
tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/PulsarFunctionsTest.java:
##########
@@ -363,17 +359,31 @@ protected void testWindowFunction(String type, String[] 
expectedResults) throws
         assertThat(i).isGreaterThanOrEqualTo(expectedResults.length - 1);
 
         // test that all messages are acked
-        stats = pulsarAdmin.topics().getStats(inputTopicName, true);
-        subStats = stats.getSubscriptions().get("public/default/" + 
functionName);
-        assertNotNull(subStats);
-        assertEquals(0, subStats.getMsgBacklog());
-        assertEquals(0, subStats.getUnackedMessages());
+        awaitAndVerifySubscriptionStats(inputTopicName, functionName, 0, 0);
 
         deleteFunction(functionName);
 
         getFunctionInfoNotFound(functionName);
     }
 
+    private void awaitAndVerifySubscriptionStats(String inputTopicName, String 
functionName, int expectedBacklog,
+                                                 int expectedUnacked) {
+        Awaitility.await()
+                // Check every 50ms
+                .pollInterval(Duration.ofMillis(50))
+                .atMost(Duration.ofSeconds(10))

Review Comment:
   The default is 10 seconds. No need for this



##########
tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/PulsarFunctionsTest.java:
##########
@@ -363,17 +359,31 @@ protected void testWindowFunction(String type, String[] 
expectedResults) throws
         assertThat(i).isGreaterThanOrEqualTo(expectedResults.length - 1);
 
         // test that all messages are acked
-        stats = pulsarAdmin.topics().getStats(inputTopicName, true);
-        subStats = stats.getSubscriptions().get("public/default/" + 
functionName);
-        assertNotNull(subStats);
-        assertEquals(0, subStats.getMsgBacklog());
-        assertEquals(0, subStats.getUnackedMessages());
+        awaitAndVerifySubscriptionStats(inputTopicName, functionName, 0, 0);
 
         deleteFunction(functionName);
 
         getFunctionInfoNotFound(functionName);
     }
 
+    private void awaitAndVerifySubscriptionStats(String inputTopicName, String 
functionName, int expectedBacklog,
+                                                 int expectedUnacked) {
+        Awaitility.await()
+                // Check every 50ms
+                .pollInterval(Duration.ofMillis(50))

Review Comment:
   Is there a need to set this at all? The default is 100ms that that should be 
sufficient.



-- 
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