From 61ce13c4f3898d2bdae1b72cd7972e863ffb5856 Mon Sep 17 00:00:00 2001 From: Laszlo Denes Terjeki Date: Wed, 5 Jun 2024 16:41:30 +0000 Subject: [PATCH] NIFI-13365 - Fix unit tests running in kubernetes pod --- .../cachemanager/ExternalHazelcastCacheManagerTest.java | 1 + .../state/provider/KubernetesConfigMapStateProviderTest.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/test/java/org/apache/nifi/hazelcast/services/cachemanager/ExternalHazelcastCacheManagerTest.java b/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/test/java/org/apache/nifi/hazelcast/services/cachemanager/ExternalHazelcastCacheManagerTest.java index 4284f20407..437d94dc37 100644 --- a/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/test/java/org/apache/nifi/hazelcast/services/cachemanager/ExternalHazelcastCacheManagerTest.java +++ b/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/test/java/org/apache/nifi/hazelcast/services/cachemanager/ExternalHazelcastCacheManagerTest.java @@ -37,6 +37,7 @@ public class ExternalHazelcastCacheManagerTest extends AbstractHazelcastCacheMan final Config config = new Config(); config.getNetworkConfig().setPort(0); config.setClusterName("nifi"); + config.getNetworkConfig().getJoin().getAutoDetectionConfig().setEnabled(false); hazelcastInstance = Hazelcast.newHazelcastInstance(config); super.setUp(); diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-kubernetes-bundle/nifi-framework-kubernetes-state-provider/src/test/java/org/apache/nifi/kubernetes/state/provider/KubernetesConfigMapStateProviderTest.java b/nifi-framework-bundle/nifi-framework/nifi-framework-kubernetes-bundle/nifi-framework-kubernetes-state-provider/src/test/java/org/apache/nifi/kubernetes/state/provider/KubernetesConfigMapStateProviderTest.java index d833113b97..da354093ce 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-kubernetes-bundle/nifi-framework-kubernetes-state-provider/src/test/java/org/apache/nifi/kubernetes/state/provider/KubernetesConfigMapStateProviderTest.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-kubernetes-bundle/nifi-framework-kubernetes-state-provider/src/test/java/org/apache/nifi/kubernetes/state/provider/KubernetesConfigMapStateProviderTest.java @@ -28,6 +28,7 @@ import org.apache.nifi.components.ValidationResult; import org.apache.nifi.components.state.Scope; import org.apache.nifi.components.state.StateMap; import org.apache.nifi.components.state.StateProviderInitializationContext; +import org.apache.nifi.kubernetes.client.ServiceAccountNamespaceProvider; import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.parameter.ParameterLookup; import org.apache.nifi.util.MockProcessContext; @@ -63,7 +64,7 @@ class KubernetesConfigMapStateProviderTest { private static final String SECOND_VERSION = "2"; - private static final String DEFAULT_NAMESPACE = "default"; + private static final String DEFAULT_NAMESPACE = new ServiceAccountNamespaceProvider().getNamespace(); private static final String COMPONENT_ID = "COMPONENT-ID";