vraulji567 commented on code in PR #21171:
URL: https://github.com/apache/pulsar/pull/21171#discussion_r1325066266
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/NamespacesTest.java:
##########
@@ -2106,4 +2106,63 @@ public void testDeleteTopicPolicyWhenDeleteSystemTopic()
throws Exception {
.getTopicPoliciesBypassCacheAsync(TopicName.get(systemTopic)).get(5,
TimeUnit.SECONDS);
assertNull(topicPolicies);
}
+
+ @Test
+ public void testCreateNamespacesWithPolicy() throws Exception {
+ try {
+ namespaces.createNamespace(this.testTenant, "other-colo",
"my-namespace",
+ new Policies());
+ fail("should have failed");
+ } catch (RestException e) {
+ // Ok, cluster doesn't exist
+ }
+
+ List<NamespaceName> nsnames = new ArrayList<>();
+ nsnames.add(NamespaceName.get(this.testTenant, "use",
"create-namespace-1"));
+ nsnames.add(NamespaceName.get(this.testTenant, "use",
"create-namespace-2"));
+ nsnames.add(NamespaceName.get(this.testTenant, "usc",
"create-other-namespace-1"));
+ createTestNamespaces(nsnames, new Policies());
+
+ try {
+ namespaces.createNamespace(this.testTenant, "use",
"create-namespace-1",
+ new Policies());
+ fail("should have failed");
+ } catch (RestException e) {
+ // Ok, namespace already exists
Review Comment:
Added asserts for the response error codes
--
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]