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 15:17:59 UTC

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

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



##########
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:
       I am not sure I understand your concern correctly. I try to answer with following. Correct me if mistake happens.
   
   * The returned `MutableBoolean` is one per listening. It is used in assertion after all procedures done. So if assertion fails, it is a bug either production or test scope.
   * Every listening is serving for one bundle(eg. `namespaceBundle` in parameter list). Multiple listening return different `MutableBoolean` for combination of `broker` and `namespaceBundle`. There is no sharing.
   
   > If call listenNamespaceBundleLoading multiple times, it will register multiple listeners to the namespace service, is this an expected behavior for your test?
   
   There is no multiple listening for same combination of `broker` and `namespaceBundle` in test code.




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