diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/MultiBrokerTestZKBaseTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/MultiBrokerTestZKBaseTest.java index d6a39fadec4da..e5b80c0af33ab 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/MultiBrokerTestZKBaseTest.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/MultiBrokerTestZKBaseTest.java @@ -65,6 +65,7 @@ protected void onCleanup() { @Override protected PulsarTestContext.Builder createPulsarTestContextBuilder(ServiceConfiguration conf) { return super.createPulsarTestContextBuilder(conf) + .spyNoneByDefault() .localMetadataStore(createMetadataStore(MetadataStoreConfig.METADATA_STORE)) .configurationMetadataStore(createMetadataStore(MetadataStoreConfig.CONFIGURATION_METADATA_STORE)); } diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/PulsarTestContext.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/PulsarTestContext.java index be5397916b394..13209ccfce7d3 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/PulsarTestContext.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/PulsarTestContext.java @@ -331,7 +331,17 @@ protected long resolveBrokerShutdownTimeoutMs() { * @return the builder */ public Builder spyByDefault() { - spyConfigBuilder = SpyConfig.builder(SpyConfig.SpyType.SPY); + spyConfigDefault(SpyConfig.SpyType.SPY); + return this; + } + + public Builder spyNoneByDefault() { + spyConfigDefault(SpyConfig.SpyType.NONE); + return this; + } + + public Builder spyConfigDefault(SpyConfig.SpyType spyType) { + spyConfigBuilder = SpyConfig.builder(spyType); return this; } diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/SpyConfig.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/SpyConfig.java index 8c42998ab0b29..64789d1f0d487 100644 --- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/SpyConfig.java +++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/SpyConfig.java @@ -129,6 +129,11 @@ public static Builder builder() { */ public static Builder builder(SpyType defaultSpyType) { Builder spyConfigBuilder = new Builder(); + configureDefaults(spyConfigBuilder, defaultSpyType); + return spyConfigBuilder; + } + + public static void configureDefaults(Builder spyConfigBuilder, SpyType defaultSpyType) { spyConfigBuilder.pulsarService(defaultSpyType); spyConfigBuilder.pulsarResources(defaultSpyType); spyConfigBuilder.brokerService(defaultSpyType); @@ -136,6 +141,5 @@ public static Builder builder(SpyType defaultSpyType) { spyConfigBuilder.compactor(defaultSpyType); spyConfigBuilder.compactedServiceFactory(defaultSpyType); spyConfigBuilder.namespaceService(defaultSpyType); - return spyConfigBuilder; } }