[fix][flaky-test] Try to fix flaky test related to PersistentTopicTest.setup
@@ -102,6 +102,7 @@ import org.apache.pulsar.broker.ServiceConfiguration;
import org.apache.pulsar.broker.namespace.NamespaceService;
import org.apache.pulsar.broker.resources.NamespaceResources;
import org.apache.pulsar.broker.resources.PulsarResources;
+import org.apache.pulsar.broker.resources.TopicResources;
import org.apache.pulsar.broker.service.persistent.CompactorSubscription;
import org.apache.pulsar.broker.service.persistent.PersistentDispatcherMultipleConsumers;
import org.apache.pulsar.broker.service.persistent.PersistentDispatcherSingleActiveConsumer;
@@ -211,7 +212,9 @@ public class PersistentTopicTest extends MockedBookKeeperTestCase {
store = new ZKMetadataStore(mockZk);
PulsarResources pulsarResources = spyWithClassAndConstructorArgs(PulsarResources.class, store, store);
NamespaceResources nsr = spyWithClassAndConstructorArgs(NamespaceResources.class, store, store, 30);
+ TopicResources tsr = spyWithClassAndConstructorArgs(TopicResources.class, store);
doReturn(nsr).when(pulsarResources).getNamespaceResources();
+ doReturn(tsr).when(pulsarResources).getTopicResources();
doReturn(pulsarResources).when(pulsar).getPulsarResources();
doReturn(store).when(pulsar).getLocalMetadataStore();
