linzihao1999 commented on code in PR #14693:
URL: https://github.com/apache/kafka/pull/14693#discussion_r1389074590


##########
core/src/test/scala/unit/kafka/server/LogRecoveryTest.scala:
##########
@@ -212,7 +228,7 @@ class LogRecoveryTest extends QuorumTestHarness {
     server2.startup()
     updateProducer()
     // check if leader moves to the other server
-    leader = waitUntilLeaderIsElectedOrChanged(zkClient, topic, partitionId, 
oldLeaderOpt = Some(leader))
+    leader = awaitLeaderChange(servers, topicPartition, leader)

Review Comment:
   I think waitUntilLeaderIsElectedOrChangedWithAdmin can use to instead of it.



##########
core/src/test/scala/unit/kafka/server/LogRecoveryTest.scala:
##########
@@ -78,15 +84,20 @@ class LogRecoveryTest extends QuorumTestHarness {
   override def setUp(testInfo: TestInfo): Unit = {
     super.setUp(testInfo)
 
-    configs = TestUtils.createBrokerConfigs(2, zkConnect, 
enableControlledShutdown = false).map(KafkaConfig.fromProps(_, overridingProps))
+    configs = TestUtils.createBrokerConfigs(2, zkConnectOrNull, 
enableControlledShutdown = false).map(KafkaConfig.fromProps(_, overridingProps))
 
     // start both servers
-    server1 = TestUtils.createServer(configProps1)
-    server2 = TestUtils.createServer(configProps2)
+    server1 = createBroker(configProps1)
+    server2 = createBroker(configProps2)
     servers = List(server1, server2)
 
     // create topic with 1 partition, 2 replicas, one on each broker
-    createTopic(zkClient, topic, partitionReplicaAssignment = Map(0 -> 
Seq(0,1)), servers = servers)
+    if (isKRaftTest()) {
+      admin = createAdminClient(servers, 
ListenerName.forSecurityProtocol(SecurityProtocol.PLAINTEXT))
+      createTopicWithAdmin(admin, topic, servers, 2, replicaAssignment = Map(0 
-> Seq(0, 1)))
+    } else {
+      createTopic(zkClient, topic, partitionReplicaAssignment = Map(0 -> 
Seq(0, 1)), servers = servers)
+    }

Review Comment:
   I think createTopicWithAdmin includes ZK and KRaft mode, and no need to use 
`isKRaftTest` to explicitly determine it.



-- 
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

Reply via email to