m1a2st commented on code in PR #18417:
URL: https://github.com/apache/kafka/pull/18417#discussion_r1905629931
##########
core/src/test/scala/unit/kafka/server/KafkaApisTest.scala:
##########
@@ -9705,77 +9514,6 @@ class KafkaApisTest extends Logging {
assertEquals(expectedError, leaderAndIsrResponse.error())
}
- @Test
- def testStopReplicaRequestWithCurrentBrokerEpoch(): Unit = {
- val currentBrokerEpoch = 1239875L
- testStopReplicaRequest(currentBrokerEpoch, currentBrokerEpoch, Errors.NONE)
- }
-
- @Test
- def testStopReplicaRequestWithNewerBrokerEpochIsValid(): Unit = {
- val currentBrokerEpoch = 1239875L
- testStopReplicaRequest(currentBrokerEpoch, currentBrokerEpoch + 1,
Errors.NONE)
- }
-
- @Test
- def testStopReplicaRequestWithStaleBrokerEpochIsRejected(): Unit = {
- val currentBrokerEpoch = 1239875L
- testStopReplicaRequest(currentBrokerEpoch, currentBrokerEpoch - 1,
Errors.STALE_BROKER_EPOCH)
- }
Review Comment:
These tests are testing `STOP_REPLICA` api, it only use in zookeeper, thus
we should remove it.
##########
core/src/test/scala/unit/kafka/server/KafkaApisTest.scala:
##########
@@ -3035,98 +3002,6 @@ class KafkaApisTest extends Logging {
assertEquals(2, markersResponse.errorsByProducerId.size())
}
- @Test
- def
shouldResignCoordinatorsIfStopReplicaReceivedWithDeleteFlagAndLeaderEpoch():
Unit = {
- shouldResignCoordinatorsIfStopReplicaReceivedWithDeleteFlag(
- LeaderAndIsr.INITIAL_LEADER_EPOCH + 2, deletePartition = true)
- }
-
- @Test
- def
shouldResignCoordinatorsIfStopReplicaReceivedWithDeleteFlagAndDeleteSentinel():
Unit = {
- shouldResignCoordinatorsIfStopReplicaReceivedWithDeleteFlag(
- LeaderAndIsr.EPOCH_DURING_DELETE, deletePartition = true)
- }
-
- @Test
- def
shouldResignCoordinatorsIfStopReplicaReceivedWithDeleteFlagAndNoEpochSentinel():
Unit = {
- shouldResignCoordinatorsIfStopReplicaReceivedWithDeleteFlag(
- LeaderAndIsr.NO_EPOCH, deletePartition = true)
- }
-
- @Test
- def shouldNotResignCoordinatorsIfStopReplicaReceivedWithoutDeleteFlag():
Unit = {
- shouldResignCoordinatorsIfStopReplicaReceivedWithDeleteFlag(
- LeaderAndIsr.INITIAL_LEADER_EPOCH + 2, deletePartition = false)
- }
-
- def shouldResignCoordinatorsIfStopReplicaReceivedWithDeleteFlag(leaderEpoch:
Int,
Review Comment:
These tests are testing `STOP_REPLICA` api, it only use in zookeeper, thus
we should remove it.
##########
core/src/test/scala/unit/kafka/server/KafkaApisTest.scala:
##########
@@ -9590,12 +9405,6 @@ class KafkaApisTest extends Logging {
assertEquals(records.sizeInBytes(),
brokerTopicStats.allTopicsStats.replicationBytesOutRate.get.count())
}
- @Test
- def testUpdateMetadataRequestWithCurrentBrokerEpoch(): Unit = {
- val currentBrokerEpoch = 1239875L
- testUpdateMetadataRequest(currentBrokerEpoch, currentBrokerEpoch,
Errors.NONE)
- }
Review Comment:
This test is testing`UPDATE_METADATA` api, it only use in zookeeper, thus we
should remove it.
##########
core/src/test/scala/unit/kafka/server/KafkaApisTest.scala:
##########
@@ -4279,66 +4154,6 @@ class KafkaApisTest extends Logging {
assertEquals(Set(0), response.brokers.asScala.map(_.id).toSet)
}
-
- /**
- * Metadata request to fetch all topics should not result in the followings:
- * 1) Auto topic creation
- * 2) UNKNOWN_TOPIC_OR_PARTITION
- *
- * This case is testing the case that a topic is being deleted from
MetadataCache right after
- * authorization but before checking in MetadataCache.
- */
- @Test
- def
testGetAllTopicMetadataShouldNotCreateTopicOrReturnUnknownTopicPartition():
Unit = {
- // Setup: authorizer authorizes 2 topics, but one got deleted in metadata
cache
- metadataCache = mock(classOf[ZkMetadataCache])
- when(metadataCache.getAliveBrokerNodes(any())).thenReturn(List(new
Node(brokerId,"localhost", 0)))
- when(metadataCache.getControllerId).thenReturn(None)
-
- // 2 topics returned for authorization in during handle
- val topicsReturnedFromMetadataCacheForAuthorization =
Set("remaining-topic", "later-deleted-topic")
-
when(metadataCache.getAllTopics()).thenReturn(topicsReturnedFromMetadataCacheForAuthorization)
- // 1 topic is deleted from metadata right at the time between
authorization and the next getTopicMetadata() call
- when(metadataCache.getTopicMetadata(
- ArgumentMatchers.eq(topicsReturnedFromMetadataCacheForAuthorization),
- any[ListenerName],
- anyBoolean,
- anyBoolean
- )).thenReturn(Seq(
- new MetadataResponseTopic()
- .setErrorCode(Errors.NONE.code)
- .setName("remaining-topic")
- .setIsInternal(false)
- ))
-
-
- var createTopicIsCalled: Boolean = false
- // Specific mock on zkClient for this use case
- // Expect it's never called to do auto topic creation
- when(zkClient.setOrCreateEntityConfigs(
- ArgumentMatchers.eq(ConfigType.TOPIC),
- anyString,
- any[Properties]
- )).thenAnswer(_ => {
- createTopicIsCalled = true
- })
- // No need to use
- when(zkClient.getAllBrokersInCluster)
- .thenReturn(Seq(new Broker(
- brokerId, "localhost", 9902,
- ListenerName.forSecurityProtocol(SecurityProtocol.PLAINTEXT),
SecurityProtocol.PLAINTEXT
- )))
-
-
- val (requestListener, _) = updateMetadataCacheWithInconsistentListeners()
- val response =
sendMetadataRequestWithInconsistentListeners(requestListener)
Review Comment:
This test is testing `UPDATE_METADATA` api, it only use in zookeeper, thus
we should remove 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]