showuon commented on code in PR #15077: URL: https://github.com/apache/kafka/pull/15077#discussion_r1437024347
########## core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala: ########## @@ -2704,28 +2710,30 @@ class ReplicaManagerTest { time = time, scheduler = time.scheduler, logManager = logManager, - quotaManagers = QuotaFactory.instantiate(config, metrics, time, ""), + quotaManagers = quotaManager, metadataCache = MetadataCache.zkMetadataCache(config.brokerId, config.interBrokerProtocolVersion), logDirFailureChannel = new LogDirFailureChannel(config.logDirs.size), alterPartitionManager = alterPartitionManager, threadNamePrefix = Option(this.getClass.getName)) - logManager.startup(Set.empty[String]) - - // Create a hosted topic, a hosted topic that will become stray, and a stray topic - val validLogs = createHostedLogs("hosted-topic", numLogs = 2, replicaManager).toSet - createHostedLogs("hosted-stray", numLogs = 10, replicaManager).toSet - createStrayLogs(10, logManager) + try { + logManager.startup(Set.empty[String]) - val allReplicasFromLISR = Set(new TopicPartition("hosted-topic", 0), new TopicPartition("hosted-topic", 1)) + // Create a hosted topic, a hosted topic that will become stray, and a stray topic + val validLogs = createHostedLogs("hosted-topic", numLogs = 2, replicaManager).toSet + createHostedLogs("hosted-stray", numLogs = 10, replicaManager).toSet + createStrayLogs(10, logManager) - replicaManager.updateStrayLogs(replicaManager.findStrayPartitionsFromLeaderAndIsr(allReplicasFromLISR)) + val allReplicasFromLISR = Set(new TopicPartition("hosted-topic", 0), new TopicPartition("hosted-topic", 1)) - assertEquals(validLogs, logManager.allLogs.toSet) - assertEquals(validLogs.size, replicaManager.partitionCount.value) + replicaManager.updateStrayLogs(replicaManager.findStrayPartitionsFromLeaderAndIsr(allReplicasFromLISR)) - replicaManager.shutdown() - logManager.shutdown() + assertEquals(validLogs, logManager.allLogs.toSet) + assertEquals(validLogs.size, replicaManager.partitionCount.value) + } finally { + replicaManager.shutdown() + logManager.shutdown() Review Comment: I think what Satish wants is we close both of them without throwing any exception to not closing the 2nd instance. -- 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