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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to