You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/04/11 14:50:24 UTC

[GitHub] [pulsar] codelipenghui commented on a change in pull request #10165: Add assertions for namespace listener in test cases when zookeeper disconnected

codelipenghui commented on a change in pull request #10165:
URL: https://github.com/apache/pulsar/pull/10165#discussion_r611199961



##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/service/TopicOwnerTest.java
##########
@@ -240,6 +245,28 @@ private void spyZookeeperToDisconnectAfterPersist(ZooKeeper zooKeeper, RequestMa
         }).when(spyZooKeeperServer).submitRequest(any(Request.class));
     }
 
+    private MutableBoolean listenNamespaceBundleLoading(PulsarService broker, NamespaceBundle namespaceBundle) {
+        NamespaceService namespaceService = broker.getNamespaceService();
+        final MutableBoolean loaded = new MutableBoolean();
+        namespaceService.addNamespaceBundleOwnershipListener(new NamespaceBundleOwnershipListener() {

Review comment:
       If call listenNamespaceBundleLoading multiple times, it will register multiple listeners to the namespace service, is this an expected behavior for your test? In my opinion, we only need to add one listener for the same purpose?
   
   And the MutableBoolean will be changed during the test execution, I noticed the MutableBoolean is used for asserting, this will introduce flaky tests.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org