diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationServiceOverrider.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationServiceOverrider.java index 39898acb20..c094b2c884 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationServiceOverrider.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationServiceOverrider.java @@ -4,7 +4,6 @@ import java.util.Optional; import java.util.Set; import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import java.util.function.Consumer; import io.fabric8.kubernetes.client.Config; @@ -191,13 +190,13 @@ public boolean closeClientOnStop() { @Override public ExecutorService getExecutorService() { return executorService != null ? executorService - : Executors.newFixedThreadPool(concurrentReconciliationThreads()); + : super.getExecutorService(); } @Override public ExecutorService getWorkflowExecutorService() { return workflowExecutorService != null ? workflowExecutorService - : Executors.newFixedThreadPool(concurrentWorkflowExecutorThreads()); + : super.getWorkflowExecutorService(); } @Override diff --git a/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/api/config/ConfigurationServiceOverriderTest.java b/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/api/config/ConfigurationServiceOverriderTest.java index 607cde2935..60ca5fcee3 100644 --- a/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/api/config/ConfigurationServiceOverriderTest.java +++ b/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/api/config/ConfigurationServiceOverriderTest.java @@ -120,4 +120,5 @@ public R clone(R object) { assertNotEquals(config.getInformerStoppedHandler(), overridden.getLeaderElectionConfiguration()); } + } diff --git a/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/EventProcessorTest.java b/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/EventProcessorTest.java index c3880982e6..a7e431b88c 100644 --- a/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/EventProcessorTest.java +++ b/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/EventProcessorTest.java @@ -15,10 +15,7 @@ import org.slf4j.LoggerFactory; import io.fabric8.kubernetes.api.model.HasMetadata; -import io.javaoperatorsdk.operator.api.config.ConfigurationServiceProvider; -import io.javaoperatorsdk.operator.api.config.ControllerConfiguration; -import io.javaoperatorsdk.operator.api.config.ExecutorServiceManager; -import io.javaoperatorsdk.operator.api.config.RetryConfiguration; +import io.javaoperatorsdk.operator.api.config.*; import io.javaoperatorsdk.operator.api.monitoring.Metrics; import io.javaoperatorsdk.operator.processing.event.rate.LinearRateLimiter; import io.javaoperatorsdk.operator.processing.event.rate.RateLimiter; @@ -430,7 +427,10 @@ void executionOfReconciliationShouldNotStartIfProcessorStopped() throws Interrup return PostExecutionControl.defaultDispatch(); }); // one event will lock the thread / executor - ConfigurationServiceProvider.overrideCurrent(o -> o.withConcurrentReconciliationThreads(1)); + ConfigurationServiceProvider.overrideCurrent(o -> { + o.withConcurrentReconciliationThreads(1); + o.withMinConcurrentReconciliationThreads(1); + }); ExecutorServiceManager.reset(); eventProcessor.start(); @@ -490,6 +490,7 @@ ControllerConfiguration controllerConfiguration(Retry retry, RateLimiter rateLim when(res.getRetry()).thenReturn(retry); when(res.getRateLimiter()).thenReturn(rateLimiter); when(res.maxReconciliationInterval()).thenReturn(Optional.of(Duration.ofMillis(1000))); + when(res.getConfigurationService()).thenReturn(new BaseConfigurationService()); return res; }