@@ -644,6 +644,49 @@ public void testDeleteNonExistentConfigIsIdempotent() throws Exception {
644644 }
645645 }
646646
647+ @ ClusterTest
648+ public void testDeleteNonExistentConfigIsIdempotentWithBootstrapController () throws Exception {
649+ String topicName = "test-delete-nonexistent-topic" ;
650+ try (Admin bootstrapControllerClient = cluster .admin (Map .of (), true );
651+ Admin bootstrapServerClient = cluster .admin (Map .of ())) {
652+ bootstrapServerClient .createTopics (List .of (new NewTopic (topicName , 1 , (short ) 1 ))).all ().get ();
653+ ConfigCommand .alterConfig (bootstrapControllerClient , new ConfigCommand .ConfigCommandOptions (toArray (
654+ List .of ("--bootstrap-controller" , cluster .bootstrapControllers (),
655+ "--entity-type" , "topics" , "--entity-name" , topicName ,
656+ "--alter" , "--delete-config" , "non.existent.config" ))));
657+
658+ ConfigCommand .alterConfig (bootstrapControllerClient , new ConfigCommand .ConfigCommandOptions (toArray (
659+ List .of ("--bootstrap-controller" , cluster .bootstrapControllers (),
660+ "--entity-type" , "brokers" , "--entity-name" , defaultBrokerId ,
661+ "--alter" , "--delete-config" , "non.existent.config" ))));
662+
663+ ConfigCommand .alterConfig (bootstrapControllerClient , new ConfigCommand .ConfigCommandOptions (toArray (
664+ List .of ("--bootstrap-controller" , cluster .bootstrapControllers (),
665+ "--entity-type" , "brokers" , "--entity-default" ,
666+ "--alter" , "--delete-config" , "non.existent.config" ))));
667+ }
668+ }
669+
670+ @ ClusterTest (brokers = 2 )
671+ public void testAlterBrokerConfigWithOfflineBroker () throws Exception {
672+ int offlineBrokerId = cluster .brokerIds ().stream ()
673+ .filter (id -> !cluster .controllerIds ().contains (id ))
674+ .findFirst ()
675+ .orElseThrow ();
676+ cluster .shutdownBroker (offlineBrokerId );
677+ TestUtils .waitForCondition (
678+ () -> !cluster .aliveBrokers ().containsKey (offlineBrokerId ),
679+ "Broker " + offlineBrokerId + " did not shut down in time"
680+ );
681+
682+ try (Admin client = cluster .admin (Map .of (), true )) {
683+ ConfigCommand .alterConfig (client , new ConfigCommand .ConfigCommandOptions (toArray (
684+ List .of ("--bootstrap-controller" , cluster .bootstrapControllers (),
685+ "--entity-type" , "brokers" , "--entity-name" , String .valueOf (offlineBrokerId ),
686+ "--alter" , "--delete-config" , "log.retention.ms" ))));
687+ }
688+ }
689+
647690 // Test case from KAFKA-13788
648691 @ ClusterTest (serverProperties = {
649692 // Must be at greater than 1MB per cleaner thread, set to 2M+2 so that we can set 2 cleaner threads.
0 commit comments