Skip to content

Commit

Permalink
KAFKA-12557: Fix hanging KafkaAdminClientTest (apache#10404)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
vvcephei authored Mar 30, 2021
1 parent 0018c3c commit d02ad2c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
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;
Expand Down Expand Up @@ -113,7 +114,10 @@ public MockClient kafkaClient() {

@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) {
Expand Down

0 comments on commit d02ad2c

Please sign in to comment.