OmniaGM commented on code in PR #16127: URL: https://github.com/apache/kafka/pull/16127#discussion_r1706649011
########## tools/src/test/java/org/apache/kafka/tools/TopicCommandIntegrationTest.java: ########## @@ -85,653 +80,761 @@ import static org.mockito.Mockito.spy; @Tag("integration") -@SuppressWarnings("deprecation") // Added for Scala 2.12 compatibility for usages of JavaConverters -public class TopicCommandIntegrationTest extends kafka.integration.KafkaServerTestHarness implements Logging, RackAwareTest { +@ExtendWith(ClusterTestExtensions.class) +public class TopicCommandIntegrationTest { private final short defaultReplicationFactor = 1; private final int defaultNumPartitions = 1; - private TopicCommand.TopicService topicService; - private Admin adminClient; - private String bootstrapServer; - private String testTopicName; - private Buffer<KafkaBroker> scalaBrokers; - private Seq<ControllerServer> scalaControllers; - /** - * Implementations must override this method to return a set of KafkaConfigs. This method will be invoked for every - * test and should not reuse previous configurations unless they select their ports randomly when servers are started. - * - * Note the replica fetch max bytes is set to `1` in order to throttle the rate of replication for test - * `testDescribeUnderReplicatedPartitionsWhenReassignmentIsInProgress`. - */ - @Override - public scala.collection.Seq<KafkaConfig> generateConfigs() { - Map<Integer, String> rackInfo = new HashMap<>(); - rackInfo.put(0, "rack1"); - rackInfo.put(1, "rack2"); - rackInfo.put(2, "rack2"); - rackInfo.put(3, "rack1"); - rackInfo.put(4, "rack3"); - rackInfo.put(5, "rack3"); - - List<Properties> brokerConfigs = ToolsTestUtils - .createBrokerProperties(6, zkConnectOrNull(), rackInfo, defaultNumPartitions, defaultReplicationFactor); - - List<KafkaConfig> configs = new ArrayList<>(); - for (Properties props : brokerConfigs) { - props.put(REPLICA_FETCH_MAX_BYTES_CONFIG, "1"); - configs.add(KafkaConfig.fromProps(props)); - } - return JavaConverters.asScalaBuffer(configs).toSeq(); - } + private final ClusterInstance clusterInstance; private TopicCommand.TopicCommandOptions buildTopicCommandOptionsWithBootstrap(String... opts) { + String bootstrapServer = clusterInstance.bootstrapServers(); String[] finalOptions = Stream.concat(Arrays.stream(opts), Stream.of("--bootstrap-server", bootstrapServer) ).toArray(String[]::new); return new TopicCommand.TopicCommandOptions(finalOptions); } - @BeforeEach - public void setUp(TestInfo info) { - super.setUp(info); - // create adminClient - Properties props = new Properties(); - bootstrapServer = bootstrapServers(listenerName()); - props.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, bootstrapServer); - adminClient = Admin.create(props); - topicService = new TopicCommand.TopicService(props, Optional.of(bootstrapServer)); - testTopicName = String.format("%s-%s", info.getTestMethod().get().getName(), org.apache.kafka.test.TestUtils.randomString(10)); - scalaBrokers = brokers(); - scalaControllers = controllerServers(); + static List<ClusterConfig> generate1() { Review Comment: why it is called `generate1` if there is no any 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-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org