mumrah commented on code in PR #14545: URL: https://github.com/apache/kafka/pull/14545#discussion_r1367032618
########## core/src/test/scala/integration/kafka/zk/ZkMigrationIntegrationTest.scala: ########## @@ -265,6 +265,96 @@ class ZkMigrationIntegrationTest { migrationState = migrationClient.releaseControllerLeadership(migrationState) } + @ClusterTemplate("zkClustersForAllMigrationVersions") + def testMigrateTopicDeletions(zkCluster: ClusterInstance): Unit = { + // Create a topic in ZK mode + var admin = zkCluster.createAdminClient() + val newTopics = new util.ArrayList[NewTopic]() + newTopics.add(new NewTopic("test-topic-1", 100, 3.toShort)) + newTopics.add(new NewTopic("test-topic-2", 100, 3.toShort)) + newTopics.add(new NewTopic("test-topic-3", 100, 3.toShort)) + val createTopicResult = admin.createTopics(newTopics) + createTopicResult.all().get(300, TimeUnit.SECONDS) + admin.close() + val zkClient = zkCluster.asInstanceOf[ZkClusterInstance].getUnderlying().zkClient + + // Bootstrap the ZK cluster ID into KRaft + val clusterId = zkCluster.clusterId() + val kraftCluster = new KafkaClusterTestKit.Builder( + new TestKitNodes.Builder(). + setBootstrapMetadataVersion(zkCluster.config().metadataVersion()). + setClusterId(Uuid.fromString(clusterId)). + setNumBrokerNodes(0). + setNumControllerNodes(1).build()) + .setConfigProp(KafkaConfig.MigrationEnabledProp, "true") + .setConfigProp(KafkaConfig.ZkConnectProp, zkCluster.asInstanceOf[ZkClusterInstance].getUnderlying.zkConnect) + .build() + try { + kraftCluster.format() + kraftCluster.startup() + val readyFuture = kraftCluster.controllers().values().asScala.head.controller.waitForReadyBrokers(3) + + // Start a delete, but don't wait for it + admin = zkCluster.createAdminClient() + admin.deleteTopics(Seq("test-topic-1", "test-topic-2", "test-topic-3").asJava) + admin.close() Review Comment: I increase the number of topics to delete as part of this test. That should hopefully increase the likelihood of it being successful. I also added an "Assume" to the test so it will be skipped if somehow all the topics aren't pending deletion by the time the migration starts. -- 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