chia7712 commented on code in PR #16493:
URL: https://github.com/apache/kafka/pull/16493#discussion_r1739967015


##########
core/src/test/java/kafka/admin/AclCommandTest.java:
##########
@@ -261,6 +297,27 @@ public void testAclCliWithClientId(ClusterInstance 
cluster) {
         appender.setClassLogger(AppInfoParser.class, Level.WARN);
         try {
             testAclCli(cluster, adminArgs(cluster.bootstrapServers(), 
Optional.of(TestUtils.tempFile("client.id=my-client"))));
+        } catch (InterruptedException | IOException e) {

Review Comment:
   Could you please do a bit refactor for those tests?
   ```java
           try (LogCaptureAppender appender = 
LogCaptureAppender.createAndRegister()) {
               appender.setClassLogger(AppInfoParser.class, Level.WARN);
               testAclCli(cluster, adminArgs(cluster.bootstrapServers(), 
Optional.of(TestUtils.tempFile("client.id=my-client"))));
               assertEquals(0, appender.getEvents().stream()
                       .filter(e -> e.getLevel().equals(Level.WARN.toString()))
                       .filter(e -> e.getThrowableClassName().filter(name -> 
name.equals(InstanceAlreadyExistsException.class.getName())).isPresent())
                       .count(), "There should be no warnings about multiple 
registration of mbeans");
           }
   ```



##########
core/src/test/java/kafka/admin/AclCommandTest.java:
##########
@@ -261,6 +297,27 @@ public void testAclCliWithClientId(ClusterInstance 
cluster) {
         appender.setClassLogger(AppInfoParser.class, Level.WARN);
         try {
             testAclCli(cluster, adminArgs(cluster.bootstrapServers(), 
Optional.of(TestUtils.tempFile("client.id=my-client"))));
+        } catch (InterruptedException | IOException e) {
+            throw new RuntimeException(e);
+        } finally {
+            appender.close();
+        }
+        assertEquals(0, appender.getEvents().stream()
+                .filter(e -> e.getLevel().equals(Level.WARN.toString()))
+                .filter(e -> e.getThrowableClassName().filter(name -> 
name.equals(InstanceAlreadyExistsException.class.getName())).isPresent())
+                .count(), "There should be no warnings about multiple 
registration of mbeans");
+    }
+
+    @ClusterTest(types = {Type.KRAFT}, serverProperties = {
+            @ClusterConfigProperty(key = AUTHORIZER_CLASS_NAME_CONFIG, value = 
STANDARD_AUTHORIZER)
+    })
+    public void testAclCliWithClientIdAndBootstrapController(ClusterInstance 
cluster) {
+        LogCaptureAppender appender = LogCaptureAppender.createAndRegister();
+        appender.setClassLogger(AppInfoParser.class, Level.WARN);
+        try {
+            testAclCli(cluster, 
adminArgsWithBootstrapController(cluster.bootstrapControllers(), 
Optional.of(TestUtils.tempFile("client.id=my-client"))));
+        } catch (InterruptedException | IOException e) {

Review Comment:
   ditto



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