You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Nikita-Shupletsov (via GitHub)" <gi...@apache.org> on 2026/07/27 19:05:01 UTC
[PR] MINOR: deflake AdminMetadataTest [kafka]
Nikita-Shupletsov opened a new pull request, #22968:
URL: https://github.com/apache/kafka/pull/22968
ClusterTest harness only waits for brokers to reach RUNNING, not for all of them to be registered and propagated, so a single describeCluster() can race with metadata propagation and see fewer brokers.
Adding a wait until all of them have been discovered.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: deflake AdminMetadataTest [kafka]
Posted by "lianetm (via GitHub)" <gi...@apache.org>.
lianetm commented on code in PR #22968:
URL: https://github.com/apache/kafka/pull/22968#discussion_r3660310333
##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/AdminMetadataTest.java:
##########
@@ -108,16 +108,18 @@ public void testListNodesWithFencedBroker() throws Exception {
public void testDescribeCluster() throws Exception {
try (Admin admin = clusterInstance.admin()) {
DescribeClusterResult result = admin.describeCluster();
- Collection<Node> nodes = result.nodes().get();
assertEquals(clusterInstance.clusterId(), result.clusterId().get());
// In KRaft, we return a random brokerId as the current controller.
Node controller = result.controller().get();
assertTrue(clusterInstance.brokerIds().contains(controller.id()));
Set<String> brokerEndpoints = Set.of(clusterInstance.bootstrapServers().split(","));
- assertEquals(brokerEndpoints.size(), nodes.size());
- for (Node node : nodes) {
+ TestUtils.waitForCondition(
Review Comment:
since we have the `clusterInstance` here, could we reuse the `waitForReadyBrokers`? (and maybe before doing the first describe, so we only do 1 describe but only after everything is ready)
I see that other admin tests do the `waitForReadyBrokers` on the setup phase btw, e.g., https://github.com/apache/kafka/blob/63f445aaa9688f919d0606f2c6d118b6a7e3f3b3/clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/AdminClientWithPoliciesIntegrationTest.java#L72
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: deflake AdminMetadataTest [kafka]
Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on code in PR #22968:
URL: https://github.com/apache/kafka/pull/22968#discussion_r3664158585
##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/AdminMetadataTest.java:
##########
@@ -59,6 +61,11 @@ public class AdminMetadataTest {
this.clusterInstance = clusterInstance;
}
+ @BeforeEach
+ public void setup() throws InterruptedException {
Review Comment:
Excuse me, which flaky test would you like to fix? Are you referring to `testDescribeCluster`? If so, should we move the wait logic inside that specific test to avoid delaying others?
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: deflake AdminMetadataTest [kafka]
Posted by "lianetm (via GitHub)" <gi...@apache.org>.
lianetm merged PR #22968:
URL: https://github.com/apache/kafka/pull/22968
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: deflake AdminMetadataTest [kafka]
Posted by "Nikita-Shupletsov (via GitHub)" <gi...@apache.org>.
Nikita-Shupletsov commented on code in PR #22968:
URL: https://github.com/apache/kafka/pull/22968#discussion_r3667504423
##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/AdminMetadataTest.java:
##########
@@ -59,6 +61,11 @@ public class AdminMetadataTest {
this.clusterInstance = clusterInstance;
}
+ @BeforeEach
+ public void setup() throws InterruptedException {
Review Comment:
sounds good.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: deflake AdminMetadataTest [kafka]
Posted by "Nikita-Shupletsov (via GitHub)" <gi...@apache.org>.
Nikita-Shupletsov commented on code in PR #22968:
URL: https://github.com/apache/kafka/pull/22968#discussion_r3660804652
##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/AdminMetadataTest.java:
##########
@@ -108,16 +108,18 @@ public void testListNodesWithFencedBroker() throws Exception {
public void testDescribeCluster() throws Exception {
try (Admin admin = clusterInstance.admin()) {
DescribeClusterResult result = admin.describeCluster();
- Collection<Node> nodes = result.nodes().get();
assertEquals(clusterInstance.clusterId(), result.clusterId().get());
// In KRaft, we return a random brokerId as the current controller.
Node controller = result.controller().get();
assertTrue(clusterInstance.brokerIds().contains(controller.id()));
Set<String> brokerEndpoints = Set.of(clusterInstance.bootstrapServers().split(","));
- assertEquals(brokerEndpoints.size(), nodes.size());
- for (Node node : nodes) {
+ TestUtils.waitForCondition(
Review Comment:
yep, it's a much better approach. thanks!
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org