jsancio commented on code in PR #13241:
URL: https://github.com/apache/kafka/pull/13241#discussion_r1104851324


##########
tools/src/main/java/org/apache/kafka/tools/MetadataQuorumCommand.java:
##########
@@ -92,7 +92,7 @@ static void execute(String... args) throws Exception {
                 if (!commandConfig.exists())
                     throw new TerseException("Properties file " + 
commandConfig.getPath() + " does not exists!");
 
-                Utils.loadProps(commandConfig.getPath());
+                props = Utils.loadProps(commandConfig.getPath());

Review Comment:
   How about making `props` final with `final Properties props;`? Setting here 
and added an `else` block that sets it to `new Properties()`.



##########
tools/src/test/java/org/apache/kafka/tools/MetadataQuorumCommandTest.java:
##########
@@ -141,6 +145,16 @@ public void testOnlyOneBrokerAndOneController() {
         assertEquals("0", replicationOutput.split("\n")[1].split("\\s+")[2]);
     }
 
+    @ClusterTests({
+        @ClusterTest(clusterType = Type.CO_KRAFT, brokers = 1, controllers = 1)
+    })
+    public void testCommandConfig() throws IOException {
+        // specifying a --command-config containing properties that would 
prevent login must fail
+        File tmpfile = 
TestUtils.tempFile(AdminClientConfig.SECURITY_PROTOCOL_CONFIG + 
"=SSL_PLAINTEXT");
+        assertEquals(1, MetadataQuorumCommand.mainNoExit("--bootstrap-server", 
cluster.bootstrapServers(),
+                        "--command-config", tmpfile.getAbsolutePath(), 
"describe", "--status"));
+    }

Review Comment:
   Thanks for adding a test to make sure we don't regress this in the future.



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to