mjsax commented on code in PR #20723:
URL: https://github.com/apache/kafka/pull/20723#discussion_r2496842086


##########
streams/src/test/java/org/apache/kafka/streams/StreamsConfigTest.java:
##########
@@ -442,6 +442,51 @@ public void 
shouldOverrideAdminDefaultAdminClientEnableTelemetry() {
         assertTrue((boolean) 
returnedProps.get(AdminClientConfig.ENABLE_METRICS_PUSH_CONFIG));
     }
 
+    @Test
+    public void testAutoCreateTopicsCannotBeOverriddenForStreamsConsumers() {
+        // User tries to override the setting
+        
props.put(StreamsConfig.consumerPrefix(ConsumerConfig.ALLOW_AUTO_CREATE_TOPICS_CONFIG),
 "true");
+        
props.put(StreamsConfig.restoreConsumerPrefix(ConsumerConfig.ALLOW_AUTO_CREATE_TOPICS_CONFIG),
 "true");
+        
props.put(StreamsConfig.globalConsumerPrefix(ConsumerConfig.ALLOW_AUTO_CREATE_TOPICS_CONFIG),
 "true");
+        
props.put(StreamsConfig.mainConsumerPrefix(ConsumerConfig.ALLOW_AUTO_CREATE_TOPICS_CONFIG),
 "true");
+
+        final StreamsConfig streamsConfig = new StreamsConfig(props);
+
+        // Main consumer - verify override is ignored
+        final Map<String, Object> mainConfigs = 
streamsConfig.getMainConsumerConfigs("group", "client", 0);
+        assertEquals("false", 
mainConfigs.get(ConsumerConfig.ALLOW_AUTO_CREATE_TOPICS_CONFIG),
+                "Main consumer should not allow auto topic creation even with 
override");
+
+        // Restore consumer - verify override is ignored
+        final Map<String, Object> restoreConfigs = 
streamsConfig.getRestoreConsumerConfigs("client");
+        assertEquals("false", 
restoreConfigs.get(ConsumerConfig.ALLOW_AUTO_CREATE_TOPICS_CONFIG),
+                "Restore consumer should not allow auto topic creation even 
with override");
+
+        // Global consumer - verify override is ignored
+        final Map<String, Object> globalConfigs = 
streamsConfig.getGlobalConsumerConfigs("client");
+        assertEquals("false", 
globalConfigs.get(ConsumerConfig.ALLOW_AUTO_CREATE_TOPICS_CONFIG),
+                "Global consumer should not allow auto topic creation even 
with override");
+    }
+
+    @Test
+    public void shouldLogErrorWhenUserTriesToOverrideAutoCreateTopics() {

Review Comment:
   Should we also duplicate this test, using the three individual consumer 
prefix? (or just merge this test into the one from above?



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