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

chia7712 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 8a90ca05281 KAFKA-18076 Remove `isZkMigrationTest` and related code 
(#17922)
8a90ca05281 is described below

commit 8a90ca05281073bb5610c161772fa68702a45fcb
Author: Yung <[email protected]>
AuthorDate: Sun Nov 24 00:23:27 2024 +0800

    KAFKA-18076 Remove `isZkMigrationTest` and related code (#17922)
    
    Reviewers: Chia-Ping Tsai <[email protected]>
---
 .../kafka/api/IntegrationTestHarness.scala            |  3 ---
 .../integration/kafka/server/QuorumTestHarness.scala  |  4 ----
 core/src/test/scala/kafka/utils/TestInfoUtils.scala   |  8 --------
 .../kafka/integration/KafkaServerTestHarness.scala    |  2 +-
 .../unit/kafka/server/DeleteTopicsRequestTest.scala   | 19 -------------------
 5 files changed, 1 insertion(+), 35 deletions(-)

diff --git 
a/core/src/test/scala/integration/kafka/api/IntegrationTestHarness.scala 
b/core/src/test/scala/integration/kafka/api/IntegrationTestHarness.scala
index 2c8de8e83ec..b7efed1d495 100644
--- a/core/src/test/scala/integration/kafka/api/IntegrationTestHarness.scala
+++ b/core/src/test/scala/integration/kafka/api/IntegrationTestHarness.scala
@@ -70,9 +70,6 @@ abstract class IntegrationTestHarness extends 
KafkaServerTestHarness {
       trustStoreFile = trustStoreFile, saslProperties = serverSaslProperties, 
logDirCount = logDirCount)
     configureListeners(cfgs)
     modifyConfigs(cfgs)
-    if (isZkMigrationTest()) {
-      cfgs.foreach(_.setProperty(KRaftConfigs.MIGRATION_ENABLED_CONFIG, 
"true"))
-    }
     if (isShareGroupTest()) {
       
cfgs.foreach(_.setProperty(GroupCoordinatorConfig.GROUP_COORDINATOR_REBALANCE_PROTOCOLS_CONFIG,
 "classic,consumer,share"))
       
cfgs.foreach(_.setProperty(ServerConfigs.UNSTABLE_API_VERSIONS_ENABLE_CONFIG, 
"true"))
diff --git 
a/core/src/test/scala/integration/kafka/server/QuorumTestHarness.scala 
b/core/src/test/scala/integration/kafka/server/QuorumTestHarness.scala
index 68004876c77..cc0c2bb3662 100755
--- a/core/src/test/scala/integration/kafka/server/QuorumTestHarness.scala
+++ b/core/src/test/scala/integration/kafka/server/QuorumTestHarness.scala
@@ -197,10 +197,6 @@ abstract class QuorumTestHarness extends Logging {
     TestInfoUtils.isKRaft(testInfo)
   }
 
-  def isZkMigrationTest(): Boolean = {
-    TestInfoUtils.isZkMigrationTest(testInfo)
-  }
-
   def isShareGroupTest(): Boolean = {
     TestInfoUtils.isShareGroupTest(testInfo)
   }
diff --git a/core/src/test/scala/kafka/utils/TestInfoUtils.scala 
b/core/src/test/scala/kafka/utils/TestInfoUtils.scala
index 61483760cf9..3b7732374d5 100644
--- a/core/src/test/scala/kafka/utils/TestInfoUtils.scala
+++ b/core/src/test/scala/kafka/utils/TestInfoUtils.scala
@@ -45,14 +45,6 @@ object TestInfoUtils {
     }
   }
 
-  def isZkMigrationTest(testInfo: TestInfo): Boolean = {
-    if (!isKRaft(testInfo)) {
-      false
-    } else {
-      testInfo.getDisplayName.contains("quorum=zkMigration")
-    }
-  }
-
   final val TestWithParameterizedQuorumAndGroupProtocolNames = 
"{displayName}.quorum={0}.groupProtocol={1}"
 
   def isShareGroupTest(testInfo: TestInfo): Boolean = {
diff --git 
a/core/src/test/scala/unit/kafka/integration/KafkaServerTestHarness.scala 
b/core/src/test/scala/unit/kafka/integration/KafkaServerTestHarness.scala
index 6c4b87ddf1a..0e004b44271 100755
--- a/core/src/test/scala/unit/kafka/integration/KafkaServerTestHarness.scala
+++ b/core/src/test/scala/unit/kafka/integration/KafkaServerTestHarness.scala
@@ -413,7 +413,7 @@ abstract class KafkaServerTestHarness extends 
QuorumTestHarness {
         time = brokerTime(config.brokerId),
         threadNamePrefix = None,
         startup = false,
-        enableZkApiForwarding = isZkMigrationTest() || 
(config.migrationEnabled && 
config.interBrokerProtocolVersion.isApiForwardingEnabled)
+        enableZkApiForwarding = config.migrationEnabled && 
config.interBrokerProtocolVersion.isApiForwardingEnabled
       )
     }
   }
diff --git 
a/core/src/test/scala/unit/kafka/server/DeleteTopicsRequestTest.scala 
b/core/src/test/scala/unit/kafka/server/DeleteTopicsRequestTest.scala
index 235461c396c..74ef9d96964 100644
--- a/core/src/test/scala/unit/kafka/server/DeleteTopicsRequestTest.scala
+++ b/core/src/test/scala/unit/kafka/server/DeleteTopicsRequestTest.scala
@@ -18,7 +18,6 @@
 package kafka.server
 
 import java.util
-import java.util.Collections
 import kafka.network.SocketServer
 import kafka.utils.{Logging, TestUtils}
 import org.apache.kafka.common.Uuid
@@ -216,24 +215,6 @@ class DeleteTopicsRequestTest extends BaseRequestTest with 
Logging {
     }
   }
 
-  /*
-   * Only run this test against ZK clusters. KRaft doesn't have this behavior 
of returning NOT_CONTROLLER.
-   * Instead, the request is forwarded.
-   */
-  @ParameterizedTest
-  @ValueSource(strings = Array("zk", "zkMigration"))
-  def testNotController(quorum: String): Unit = {
-    val request = new DeleteTopicsRequest.Builder(
-        new DeleteTopicsRequestData()
-          .setTopicNames(Collections.singletonList("not-controller"))
-          .setTimeoutMs(1000)).build()
-    val response = sendDeleteTopicsRequest(request, notControllerSocketServer)
-
-    val expectedError = if (isZkMigrationTest()) Errors.NONE else 
Errors.NOT_CONTROLLER
-    val error = response.data.responses.find("not-controller").errorCode()
-    assertEquals(expectedError.code(),  error)
-  }
-
   private def validateTopicIsDeleted(topic: String): Unit = {
     val metadata = connectAndReceive[MetadataResponse](new 
MetadataRequest.Builder(
       List(topic).asJava, true).build).topicMetadata.asScala

Reply via email to