You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2022/07/26 01:49:43 UTC

[pulsar] branch master updated: [improve][test] Print topic stats and internal-stats if cannot receive message in 30s for Function Test (#16773)

This is an automated email from the ASF dual-hosted git repository.

penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 0d8e5a7a4b5 [improve][test] Print topic stats and internal-stats if cannot receive message in 30s for Function Test (#16773)
0d8e5a7a4b5 is described below

commit 0d8e5a7a4b51c39979f52f3d80f71bf93e6376ec
Author: Penghui Li <pe...@apache.org>
AuthorDate: Tue Jul 26 09:49:38 2022 +0800

    [improve][test] Print topic stats and internal-stats if cannot receive message in 30s for Function Test (#16773)
---
 .../tests/integration/functions/PulsarFunctionsTest.java     | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/PulsarFunctionsTest.java b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/PulsarFunctionsTest.java
index 12e605224bf..e313c32d4d2 100644
--- a/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/PulsarFunctionsTest.java
+++ b/tests/integration/src/test/java/org/apache/pulsar/tests/integration/functions/PulsarFunctionsTest.java
@@ -39,6 +39,8 @@ import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
+
+import io.swagger.util.Json;
 import lombok.Cleanup;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -1587,6 +1589,16 @@ public abstract class PulsarFunctionsTest extends PulsarFunctionsTestBase {
 
         for (int i = 0; i < numMessages; i++) {
             Message<byte[]> msg = consumer.receive(30, TimeUnit.SECONDS);
+            if (msg == null) {
+                log.info("Input topic stats: {}",
+                        Json.pretty(pulsarAdmin.topics().getStats(inputTopic, true)));
+                log.info("Output topic stats: {}",
+                        Json.pretty(pulsarAdmin.topics().getStats(outputTopic, true)));
+                log.info("Input topic internal-stats: {}",
+                        Json.pretty(pulsarAdmin.topics().getInternalStats(inputTopic, true)));
+                log.info("Output topic internal-stats: {}",
+                        Json.pretty(pulsarAdmin.topics().getInternalStats(outputTopic, true)));
+            }
             String logMsg = new String(msg.getValue(), UTF_8);
             log.info("Received message: '{}'", logMsg);
             assertTrue(expectedMessages.contains(logMsg), "Message '" + logMsg + "' not expected");