Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-7939: Fix timing issue in KafkaAdminClientTest.testCreateTopicsRetryBackoff #6418

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,11 @@ private static boolean groupIdIsUnrepresentable(String groupId) {
return groupId == null;
}

//for testing
int numPendingCalls() {
return runnable.pendingCalls.size();
}

@Override
public CreateTopicsResult createTopics(final Collection<NewTopic> newTopics,
final CreateTopicsOptions options) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@ public void testCreateTopicsRetryBackoff() throws Exception {
// Wait until the first attempt has failed, then advance the time
TestUtils.waitForCondition(() -> mockClient.numAwaitingResponses() == 1,
"Failed awaiting CreateTopics first request failure");

// Wait until the retry call added to the queue in AdminClient
TestUtils.waitForCondition(() -> ((KafkaAdminClient) env.adminClient()).numPendingCalls() == 1,
"Failed to add retry CreateTopics call");

time.sleep(retryBackoff);

future.get();
Expand Down