This is an automated email from the ASF dual-hosted git repository.

frankvicky pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new ab890f66f31 MINOR: Rewrite testListTopicsWithOptionListInternal 
(#22960)
ab890f66f31 is described below

commit ab890f66f31b4bc8178bdaa5e7767defc0d9f2e6
Author: TengYao Chi <[email protected]>
AuthorDate: Mon Jul 27 17:47:29 2026 +0100

    MINOR: Rewrite testListTopicsWithOptionListInternal (#22960)
    
    Rewrite `testListTopicsWithOptionListInternal` to explicitly create the
    `__consumer_offsets`  topic via Admin rather than relying on a
    `consumer.poll(100ms)` to trigger group formation.
    
    The Scala predecessor of this test relied on
    `IntegrationTestHarness.setUp()`
    pre-creating `__consumer_offsets` via `createOffsetsTopic()`. The Java
    migration in
    #22290 replaced that with a `consumer.subscribe` + `poll(100ms)`
    sequence, which
    races against internal group join timing.
    
    Reviewers: Chia-Ping Tsai <[email protected]>
---
 .../apache/kafka/clients/admin/AdminMetadataTest.java  | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git 
a/clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/AdminMetadataTest.java
 
b/clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/AdminMetadataTest.java
index 239c8e31d50..e2181a1268f 100644
--- 
a/clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/AdminMetadataTest.java
+++ 
b/clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/AdminMetadataTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.kafka.clients.admin;
 
-import org.apache.kafka.clients.consumer.Consumer;
 import org.apache.kafka.common.KafkaFuture;
 import org.apache.kafka.common.Node;
 import org.apache.kafka.common.TopicCollection;
@@ -141,20 +140,11 @@ public class AdminMetadataTest {
 
     @ClusterTest
     public void testListTopicsWithOptionListInternal() throws Exception {
+        clusterInstance.createTopic(Topic.GROUP_METADATA_TOPIC_NAME, 1, 
(short) 1);
         try (Admin admin = clusterInstance.admin()) {
-            String topic = "test-topic";
-            admin.createTopics(List.of(new NewTopic(topic, 1, (short) 
1))).all().get();
-            clusterInstance.waitTopicCreation(topic, 1);
-
-            try (Consumer<byte[], byte[]> consumer = 
clusterInstance.consumer()) {
-                consumer.subscribe(List.of(topic));
-                consumer.poll(Duration.ofMillis(100));
-            }
-
-            TestUtils.waitForCondition(() -> {
-                Set<String> topicNames = admin.listTopics(new 
ListTopicsOptions().listInternal(true)).names().get();
-                return topicNames.contains(Topic.GROUP_METADATA_TOPIC_NAME);
-            }, "Expected to see internal topic " + 
Topic.GROUP_METADATA_TOPIC_NAME);
+            Set<String> topicNames = admin.listTopics(new 
ListTopicsOptions().listInternal(true)).names().get();
+            assertTrue(topicNames.contains(Topic.GROUP_METADATA_TOPIC_NAME),
+                "Expected to see internal topic " + 
Topic.GROUP_METADATA_TOPIC_NAME);
         }
     }
 

Reply via email to