KAFKA-18441: Fix flaky KafkaAdminClientTest#testAdminClientApisAuthenticationFailure (#18735)

Reviewers: Lianet Magrans <lmagrans@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>, Andrew Schofield <aschofield@confluent.io>
This commit is contained in:
PoAn Yang 2025-01-30 16:01:20 +08:00 committed by GitHub
parent 617196c68e
commit 0dfc4017b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -1788,7 +1788,10 @@ public class KafkaAdminClientTest {
public void testAdminClientApisAuthenticationFailure() {
Cluster cluster = mockBootstrapCluster();
try (final AdminClientUnitTestEnv env = new AdminClientUnitTestEnv(Time.SYSTEM, cluster,
newStrMap(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG, "1000"))) {
newStrMap(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG, "1000",
// Default "metadata.recovery.strategy" is rebootstrap. If it meets "retry.backoff.ms" (default is 100L),
// following assertion will fail. Set it to none to avoid authentication error cleanup.
AdminClientConfig.METADATA_RECOVERY_STRATEGY_CONFIG, "none"))) {
env.kafkaClient().setNodeApiVersions(NodeApiVersions.create());
env.kafkaClient().createPendingAuthenticationError(cluster.nodes().get(0),
TimeUnit.DAYS.toMillis(1));