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 2022/07/13 07:03:31 UTC

[GitHub] [pulsar] codelipenghui commented on a diff in pull request #16562: [fix][flaky-test] testSplitBundleForMultiTimes

codelipenghui commented on code in PR #16562:
URL: https://github.com/apache/pulsar/pull/16562#discussion_r919719004


##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/NamespacesTest.java:
##########
@@ -1828,10 +1830,18 @@ public void testSplitBundleForMultiTimes() throws Exception{
         String namespace = BrokerTestUtil.newUniqueName(this.testTenant + "/namespace");
         BundlesData data = BundlesData.builder().numBundles(4).build();
         admin.namespaces().createNamespace(namespace, data);
+        LookupOptions optionsHttps = LookupOptions.builder().authoritative(false).requestHttps(true).readOnly(false).build();
+        URL localWebServiceUrl = new URL(pulsar.getSafeWebServiceAddress());
         for (int i = 0; i < 10; i ++) {
             final BundlesData bundles = admin.namespaces().getBundles(namespace);
             final String bundle = bundles.getBoundaries().get(0) + "_" + bundles.getBoundaries().get(1);
+            NamespaceBundle testBundle = new NamespaceBundle(NamespaceName.get(namespace),
+                    Range.range(Long.decode(bundles.getBoundaries().get(0)), BoundType.CLOSED,
+                            Long.decode(bundles.getBoundaries().get(1)), BoundType.OPEN),
+                    pulsar.getNamespaceService().getNamespaceBundleFactory());
+            doReturn(Optional.of(localWebServiceUrl)).when(nsSvc).getWebServiceUrl(testBundle, optionsHttps);

Review Comment:
   Can change to `doReturn(Optional.of(localWebServiceUrl)).when(nsSvc).getWebServiceUrl(testBundle, any());` since we don't care about the lookup options in this case?



-- 
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: commits-unsubscribe@pulsar.apache.org

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