ChimdumebiNebolisa commented on code in PR #25163:
URL: https://github.com/apache/pulsar/pull/25163#discussion_r3565314596


##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApi2Test.java:
##########
@@ -2458,6 +2458,32 @@ public void 
testAutoTopicCreationOverrideWithMaxNumPartitionsLimit() throws Exce
             assertTrue(ex.getCause() instanceof NotAcceptableException);
         }
     }
+
+    @Test
+    public void 
testAutoTopicCreationOverrideNonPartitionedDefaultNumPartitionsIgnored() throws 
Exception {
+        String tenantName = newUniqueName("prop-xyz2");
+        String namespaceName = tenantName + "/ns-" + 
System.currentTimeMillis();
+        TenantInfoImpl tenantInfo = new TenantInfoImpl(Set.of("role1", 
"role2"), Set.of("test"));
+        admin.tenants().createTenant(tenantName, tenantInfo);
+        admin.namespaces().createNamespace(namespaceName, Set.of("test"));
+
+        AutoTopicCreationOverride overridePolicy = 
AutoTopicCreationOverride.builder()
+                .allowAutoTopicCreation(true)
+                .topicType(TopicType.NON_PARTITIONED.toString())
+                .defaultNumPartitions(5)
+                .build();
+        admin.namespaces().setAutoTopicCreation(namespaceName, overridePolicy);

Review Comment:
   You're right. `defaultNumPartitions(5)` should fail because validation 
permits only `null`, `0`, or `1` for a non-partitioned override.
   
   The test was left over from before validation was narrowed. I updated the 
acceptance test to use `1` and verify that it is persisted while the 
auto-created topic remains non-partitioned. I also added a separate broker test 
confirming that `5` is rejected through the admin API with HTTP 412.



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

Reply via email to