You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "jsancio (via GitHub)" <gi...@apache.org> on 2023/02/13 18:11:35 UTC

[GitHub] [kafka] jsancio commented on a diff in pull request #13241: KAFKA-14711: kafaka-metadata-quorum.sh does not honor --command-confi…

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-unsubscribe@kafka.apache.org

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