Skip to content

Commit 8c5c7cc

Browse files
committed
Ensure tests wait for broker shutdown
Signed-off-by: Kyle Liberti <kliberti.us@gmail.com>
1 parent e30eaf3 commit 8c5c7cc

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

cruise-control-metrics-reporter/src/test/java/com/linkedin/kafka/cruisecontrol/metricsreporter/utils/CCContainerizedKraftCluster.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,25 @@ public void shutDownBroker(int brokerId) {
396396
timeout,
397397
String.format("Broker %s did not shutdown properly.", brokerId)
398398
);
399+
400+
// Wait until describeLogDirs fails
401+
waitUntil(
402+
() -> {
403+
try {
404+
_adminClient.describeLogDirs(Collections.singletonList(brokerId))
405+
.allDescriptions()
406+
.get(5, TimeUnit.SECONDS);
407+
return false;
408+
} catch (InterruptedException ie) {
409+
throw new RuntimeException(ie);
410+
} catch (Exception e) {
411+
return true;
412+
}
413+
},
414+
result -> result,
415+
timeout,
416+
String.format("Broker %s did not fully shut down (logDirs RPC still succeeds).", brokerId)
417+
);
399418
}
400419

401420
public static class BrokerWaitStrategy extends AbstractWaitStrategy {

0 commit comments

Comments
 (0)