This is an automated email from the ASF dual-hosted git repository.
vvcephei pushed a commit to branch 2.8
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/2.8 by this push:
new 1ccfc0b KAFKA-12557: Fix hanging KafkaAdminClientTest (#10404)
1ccfc0b is described below
commit 1ccfc0b0dacded74a9661224b0c8f24d04aa2e45
Author: John Roesler <[email protected]>
AuthorDate: Tue Mar 30 11:36:13 2021 -0500
KAFKA-12557: Fix hanging KafkaAdminClientTest (#10404)
Fix a hanging test in KafkaAdminClientTest by forcing the admin client to
shut down
whether or not there are pending requests once the test harness enters
shutdown.
Reviewers: Ismael Juma <[email protected]>, Guozhang Wang
<[email protected]>
---
.../java/org/apache/kafka/clients/admin/AdminClientUnitTestEnv.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git
a/clients/src/test/java/org/apache/kafka/clients/admin/AdminClientUnitTestEnv.java
b/clients/src/test/java/org/apache/kafka/clients/admin/AdminClientUnitTestEnv.java
index f6a808f..744ec12 100644
---
a/clients/src/test/java/org/apache/kafka/clients/admin/AdminClientUnitTestEnv.java
+++
b/clients/src/test/java/org/apache/kafka/clients/admin/AdminClientUnitTestEnv.java
@@ -23,6 +23,7 @@ import org.apache.kafka.common.Node;
import org.apache.kafka.common.utils.LogContext;
import org.apache.kafka.common.utils.Time;
+import java.time.Duration;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -113,7 +114,10 @@ public class AdminClientUnitTestEnv implements
AutoCloseable {
@Override
public void close() {
- this.adminClient.close();
+ // tell the admin client to close now
+ this.adminClient.close(Duration.ZERO);
+ // block for up to a minute until the internal threads shut down.
+ this.adminClient.close(Duration.ofMinutes(1));
}
static Map<String, Object> clientConfigs(String... overrides) {