hysuuuu opened a new pull request, #23343: URL: https://github.com/apache/kafka/pull/23343
KAFKA-21014: Fix flaky testAdminRebootstrapDisabled and testAdminRebootstrap 1. Replaced assertDoesNotThrow with TestUtils.waitForCondition to wait for topic propagation, fixing the flaky assertions. 2. Updated the Exception assertion in testAdminRebootstrapDisabled to accept both TimeoutException and ExecutionException. During local testing, the original assertion exhibited a secondary flaky failure. The AdminClient's internal 60s request deadline (defaultApiTimeoutMs) may occasionally expire before the test thread's 5s Future.get() timeout completes. When this occurs, the client explicitly fails the pending call with `org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment`. Since both exception types are valid representations of an offline broker, the assertion was updated to handle both. Error trace caught: ``` org.opentest4j.AssertionFailedError: Unexpected exception type thrown, expected: <java.util.concurrent.TimeoutException> but was: <java.util.concurrent.ExecutionException> at app//org.junit.jupiter.api.Assertions.assertThrows(Assertions.java:3128) at app//org.apache.kafka.clients.ClientRebootstrapTest.testAdminRebootstrapDisabled(ClientRebootstrapTest.java:103) Caused by: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: listTopics at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096) ``` **Testing** • Ran `./gradlew clients:clients-integration-tests:test --tests ClientRebootstrapTest.testAdminRebootstrap --tests ClientRebootstrapTest.testAdminRebootstrapDisabled --rerun-tasks` 200 times. Passed with no flakiness. -- 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]
