You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Russole (via GitHub)" <gi...@apache.org> on 2026/10/23 09:03:56 UTC

[PR] MINOR: Migrate Admin client timeout integration tests to Java [kafka]

Russole opened a new pull request, #23931:
URL: https://github.com/apache/kafka/pull/23931

   Migrate selected Admin client timeout and close tests from `PlaintextAdminIntegrationTest` to `AdminClientTimeoutIntegrationTest`, as they verify Admin client timeout and close behavior.
   
   TESTING: `./gradlew :clients:clients-integration-tests:test --tests org.apache.kafka.clients.admin.AdminClientTimeoutIntegrationTest`


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


Re: [PR] MINOR: Migrate Admin client timeout integration tests to Java [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 merged PR #23931:
URL: https://github.com/apache/kafka/pull/23931


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


Re: [PR] MINOR: Migrate Admin client timeout integration tests to Java [kafka]

Posted by "Russole (via GitHub)" <gi...@apache.org>.
Russole commented on PR #23931:
URL: https://github.com/apache/kafka/pull/23931#issuecomment-6443119255

   > BTW, could you migrate `testDelayedClose` and `testAdminClientHandlingBadIPWithoutTimeout` as well?
   
   Migrated both tests.


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


Re: [PR] MINOR: Migrate Admin client timeout integration tests to Java [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #23931:
URL: https://github.com/apache/kafka/pull/23931#discussion_r4381590334


##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/AdminClientTimeoutIntegrationTest.java:
##########
@@ -75,6 +86,125 @@ public void testCallInFlightTimeouts() throws Exception {
         }
     }
 
+    @ClusterTest
+    public void testDescribeConfigWithOptionTimeoutMs() {
+        try (Admin admin = createInvalidAdminClient()) {

Review Comment:
   It seems those tests don't need the cluster instance, so would you mind using `@Test` instead? `testCallInFlightTimeouts` and `testClose` still need the cluster, so please inject `ClusterInstance` as a method parameter for those two instead of via the constructor :)



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


Re: [PR] MINOR: Migrate Admin client timeout integration tests to Java [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #23931:
URL: https://github.com/apache/kafka/pull/23931#discussion_r4365068677


##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/AdminClientTimeoutIntegrationTest.java:
##########
@@ -75,6 +85,119 @@ public void testCallInFlightTimeouts() throws Exception {
         }
     }
 
+    @ClusterTest
+    public void testDescribeConfigWithOptionTimeoutMs() {
+        try (Admin admin = createInvalidAdminClient()) {
+            List<ConfigResource> configResources = List.of(
+                new ConfigResource(ConfigResource.Type.BROKER, "1"),
+                new ConfigResource(ConfigResource.Type.BROKER, "2"));
+
+            ExecutionException exception = assertThrows(ExecutionException.class,
+                () -> admin.describeConfigs(configResources, new DescribeConfigsOptions().timeoutMs(0)).all().get());
+            assertInstanceOf(TimeoutException.class, exception.getCause());
+        }
+    }
+
+    @ClusterTest
+    public void testDescribeUserScramCredentialsTimeout() {
+        try (Admin admin = createInvalidAdminClient()) {
+            ExecutionException exception = assertThrows(ExecutionException.class,
+                () -> admin.describeUserScramCredentials(List.of("tom4"),
+                    new DescribeUserScramCredentialsOptions().timeoutMs(0)).all().get());
+            assertInstanceOf(TimeoutException.class, exception.getCause());
+        }
+    }
+
+    @ClusterTest
+    public void testDescribeTransactionsTimeout() {
+        try (Admin admin = createInvalidAdminClient()) {
+            String transactionId = "foo";
+            ExecutionException exception = assertThrows(ExecutionException.class,
+                () -> admin.describeTransactions(Set.of(transactionId),
+                    new DescribeTransactionsOptions().timeoutMs(0)).description(transactionId).get());
+            assertInstanceOf(TimeoutException.class, exception.getCause());
+        }
+    }
+
+    @ClusterTest
+    public void testAbortTransactionTimeout() {
+        try (Admin admin = createInvalidAdminClient()) {
+            ExecutionException exception = assertThrows(ExecutionException.class,
+                () -> admin.abortTransaction(
+                    new AbortTransactionSpec(new TopicPartition("topic", 0), 1, (short) 1, 1),
+                    new AbortTransactionOptions().timeoutMs(0)).all().get());

Review Comment:
   Could you use `assertTimeout` to ensure that `timeoutMs(0)` actually works? Otherwise, the test still passes even if it takes 60 seconds to throw the `ExecutionException`.



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


Re: [PR] MINOR: Migrate Admin client timeout integration tests to Java [kafka]

Posted by "Russole (via GitHub)" <gi...@apache.org>.
Russole commented on PR #23931:
URL: https://github.com/apache/kafka/pull/23931#issuecomment-6468114046

   Thanks @chia7712 for the review.


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


Re: [PR] MINOR: Migrate Admin client timeout integration tests to Java [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on PR #23931:
URL: https://github.com/apache/kafka/pull/23931#issuecomment-6425463586

   BTW, could you migrate `testDelayedClose` and `testAdminClientHandlingBadIPWithoutTimeout` as well?


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


Re: [PR] MINOR: Migrate Admin client timeout integration tests to Java [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #23931:
URL: https://github.com/apache/kafka/pull/23931#discussion_r4365071395


##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/AdminClientTimeoutIntegrationTest.java:
##########
@@ -75,6 +85,119 @@ public void testCallInFlightTimeouts() throws Exception {
         }
     }
 
+    @ClusterTest
+    public void testDescribeConfigWithOptionTimeoutMs() {
+        try (Admin admin = createInvalidAdminClient()) {
+            List<ConfigResource> configResources = List.of(
+                new ConfigResource(ConfigResource.Type.BROKER, "1"),
+                new ConfigResource(ConfigResource.Type.BROKER, "2"));
+
+            ExecutionException exception = assertThrows(ExecutionException.class,
+                () -> admin.describeConfigs(configResources, new DescribeConfigsOptions().timeoutMs(0)).all().get());
+            assertInstanceOf(TimeoutException.class, exception.getCause());
+        }
+    }
+
+    @ClusterTest
+    public void testDescribeUserScramCredentialsTimeout() {
+        try (Admin admin = createInvalidAdminClient()) {
+            ExecutionException exception = assertThrows(ExecutionException.class,
+                () -> admin.describeUserScramCredentials(List.of("tom4"),
+                    new DescribeUserScramCredentialsOptions().timeoutMs(0)).all().get());
+            assertInstanceOf(TimeoutException.class, exception.getCause());
+        }
+    }
+
+    @ClusterTest
+    public void testDescribeTransactionsTimeout() {
+        try (Admin admin = createInvalidAdminClient()) {
+            String transactionId = "foo";
+            ExecutionException exception = assertThrows(ExecutionException.class,
+                () -> admin.describeTransactions(Set.of(transactionId),
+                    new DescribeTransactionsOptions().timeoutMs(0)).description(transactionId).get());
+            assertInstanceOf(TimeoutException.class, exception.getCause());
+        }
+    }
+
+    @ClusterTest
+    public void testAbortTransactionTimeout() {
+        try (Admin admin = createInvalidAdminClient()) {
+            ExecutionException exception = assertThrows(ExecutionException.class,
+                () -> admin.abortTransaction(
+                    new AbortTransactionSpec(new TopicPartition("topic", 0), 1, (short) 1, 1),
+                    new AbortTransactionOptions().timeoutMs(0)).all().get());

Review Comment:
   testDescribeConfigWithOptionTimeoutMs
   testDescribeUserScramCredentialsTimeout
   testDescribeTransactionsTimeout
   testAbortTransactionTimeout
   testListClientMetricsResourcesTimeoutMs	
   testListConfigResourcesTimeoutMs
   
   Those test cases have analoguous issues



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


Re: [PR] MINOR: Migrate Admin client timeout integration tests to Java [kafka]

Posted by "Russole (via GitHub)" <gi...@apache.org>.
Russole commented on code in PR #23931:
URL: https://github.com/apache/kafka/pull/23931#discussion_r4367357017


##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/AdminClientTimeoutIntegrationTest.java:
##########
@@ -75,6 +85,119 @@ public void testCallInFlightTimeouts() throws Exception {
         }
     }
 
+    @ClusterTest
+    public void testDescribeConfigWithOptionTimeoutMs() {
+        try (Admin admin = createInvalidAdminClient()) {
+            List<ConfigResource> configResources = List.of(
+                new ConfigResource(ConfigResource.Type.BROKER, "1"),
+                new ConfigResource(ConfigResource.Type.BROKER, "2"));
+
+            ExecutionException exception = assertThrows(ExecutionException.class,
+                () -> admin.describeConfigs(configResources, new DescribeConfigsOptions().timeoutMs(0)).all().get());
+            assertInstanceOf(TimeoutException.class, exception.getCause());
+        }
+    }
+
+    @ClusterTest
+    public void testDescribeUserScramCredentialsTimeout() {
+        try (Admin admin = createInvalidAdminClient()) {
+            ExecutionException exception = assertThrows(ExecutionException.class,
+                () -> admin.describeUserScramCredentials(List.of("tom4"),
+                    new DescribeUserScramCredentialsOptions().timeoutMs(0)).all().get());
+            assertInstanceOf(TimeoutException.class, exception.getCause());
+        }
+    }
+
+    @ClusterTest
+    public void testDescribeTransactionsTimeout() {
+        try (Admin admin = createInvalidAdminClient()) {
+            String transactionId = "foo";
+            ExecutionException exception = assertThrows(ExecutionException.class,
+                () -> admin.describeTransactions(Set.of(transactionId),
+                    new DescribeTransactionsOptions().timeoutMs(0)).description(transactionId).get());
+            assertInstanceOf(TimeoutException.class, exception.getCause());
+        }
+    }
+
+    @ClusterTest
+    public void testAbortTransactionTimeout() {
+        try (Admin admin = createInvalidAdminClient()) {
+            ExecutionException exception = assertThrows(ExecutionException.class,
+                () -> admin.abortTransaction(
+                    new AbortTransactionSpec(new TopicPartition("topic", 0), 1, (short) 1, 1),
+                    new AbortTransactionOptions().timeoutMs(0)).all().get());

Review Comment:
   Updated. The tests now use `assertTimeout` with the same 10- and 30-second limits as the previous Scala tests.



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


Re: [PR] MINOR: Migrate Admin client timeout integration tests to Java [kafka]

Posted by "Russole (via GitHub)" <gi...@apache.org>.
Russole commented on code in PR #23931:
URL: https://github.com/apache/kafka/pull/23931#discussion_r4389244289


##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/AdminClientTimeoutIntegrationTest.java:
##########
@@ -75,6 +86,125 @@ public void testCallInFlightTimeouts() throws Exception {
         }
     }
 
+    @ClusterTest
+    public void testDescribeConfigWithOptionTimeoutMs() {
+        try (Admin admin = createInvalidAdminClient()) {

Review Comment:
   Updated as suggested.



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