showuon commented on code in PR #12639:
URL: https://github.com/apache/kafka/pull/12639#discussion_r983504767


##########
core/src/test/scala/unit/kafka/server/metadata/BrokerMetadataPublisherTest.scala:
##########
@@ -178,15 +181,21 @@ class BrokerMetadataPublisherTest {
 
   private def newMockPublisher(
     broker: BrokerServer,
+    logManager: LogManager,
+    replicaManager: ReplicaManager,
+    groupCoordinator: GroupCoordinator,
+    txnCoordinator: TransactionCoordinator,
     errorHandler: FaultHandler = new MockFaultHandler("publisher")
   ): BrokerMetadataPublisher = {
+    val mockLogManager = Mockito.mock(classOf[LogManager])
+    Mockito.when(mockLogManager.allLogs).thenReturn(Iterable.empty[UnifiedLog])
     Mockito.spy(new BrokerMetadataPublisher(
       conf = broker.config,
       metadataCache = broker.metadataCache,
-      logManager = broker.logManager,
-      replicaManager = broker.replicaManager,
-      groupCoordinator = broker.groupCoordinator,
-      txnCoordinator = broker.transactionCoordinator,

Review Comment:
   Feed mock publisher with mock log manager and other managers to avoid 
duplicate resource allocation in initManager



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