Skip to content

MINOR: Migrate EligibleLeaderReplicasIntegrationTestto use new test infra #20199

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

Open
wants to merge 11 commits into
base: trunk
Choose a base branch
from

Conversation

jim0987795064
Copy link
Contributor

@jim0987795064 jim0987795064 commented Jul 18, 2025

Changes: Use ClusterTest to rewrite EligibleLeaderReplicasIntegrationTest.

@github-actions github-actions bot added triage PRs from the community core Kafka Broker tests Test fixes (including flaky tests) labels Jul 18, 2025
Copy link
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jim0987795064 thanks for this patch. a couple of comments remain. PTAL


<!-- no one depends on the server -->
<disallow pkg="kafka" />
<allow pkg="scala" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use var to avoid importing those dependencies explicitly

killBroker(initialReplicas.get(0).id());
killBroker(initialReplicas.get(1).id());
clusterInstance.shutdownBroker(initialReplicas.get(0).id());
clusterInstance.shutdownBroker(initialReplicas.get(1).id());

waitForIsrAndElr((isrSize, elrSize) -> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waitForIsrAndElr((isrSize, elrSize) -> isrSize == 0 && elrSize == 3);

return b.config().brokerId() == brokerToBeUncleanShutdown;
}).get();
KafkaBroker broker = clusterInstance.brokers().values().stream().filter(b -> b.config().brokerId() == brokerToBeUncleanShutdown)
.findFirst().get();
Seq<File> dirs = broker.logManager().liveLogDirs();
assertEquals(1, dirs.size());
CleanShutdownFileHandler handler = new CleanShutdownFileHandler(dirs.apply(0).toString());
assertTrue(handler.exists());
assertDoesNotThrow(() -> handler.delete());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assertDoesNotThrow(handler::delete);

throw new IllegalArgumentException("Must supply at least one server config.");
}
brokers().entrySet().forEach(entry -> {
if (!entry.getValue().isShutdown()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems the method is used to restart "dead" brokers, so the condition should be if (entry.getValue().isShutdown()), right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback. I've addressed issues mentioned above.

@jim0987795064 jim0987795064 changed the title (WIP) MINOR: Migrate EligibleLeaderReplicasIntegrationTestto use new test infra MINOR: Migrate EligibleLeaderReplicasIntegrationTestto use new test infra Jul 24, 2025
@github-actions github-actions bot removed the triage PRs from the community label Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Kafka Broker tests Test fixes (including flaky tests)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants