From 8048d49a38607a0c3e70e1c7419129d764a96adf Mon Sep 17 00:00:00 2001 From: wind57 Date: Mon, 25 Nov 2024 20:56:51 +0200 Subject: [PATCH] fix --- ...esClientConfigMapErrorOnReadingSourceTests.java | 14 ++++++++------ .../Fabric8ConfigMapErrorOnReadingSourceTests.java | 14 ++++++++------ .../Fabric8SecretErrorOnReadingSourceTests.java | 14 ++++++++------ 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapErrorOnReadingSourceTests.java b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapErrorOnReadingSourceTests.java index 918f9e54a..28db93263 100644 --- a/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapErrorOnReadingSourceTests.java +++ b/spring-cloud-kubernetes-client-config/src/test/java/org/springframework/cloud/kubernetes/client/config/KubernetesClientConfigMapErrorOnReadingSourceTests.java @@ -58,6 +58,8 @@ @ExtendWith(OutputCaptureExtension.class) class KubernetesClientConfigMapErrorOnReadingSourceTests { + private static final boolean NAMESPACE_BATCHED = true; + private static final V1ConfigMapList SINGLE_CONFIGMAP_LIST = new V1ConfigMapList() .addItemsItem(new V1ConfigMapBuilder() .withMetadata( @@ -113,7 +115,7 @@ void namedSingleConfigMapFails() { stubFor(get(path).willReturn(aResponse().withStatus(500).withBody("Internal Server Error"))); ConfigMapConfigProperties configMapConfigProperties = new ConfigMapConfigProperties(true, List.of(), List.of(), - Map.of(), true, name, namespace, false, true, false, RetryProperties.DEFAULT, false); + Map.of(), true, name, namespace, false, true, false, RetryProperties.DEFAULT, NAMESPACE_BATCHED); CoreV1Api api = new CoreV1Api(); KubernetesClientConfigMapPropertySourceLocator locator = new KubernetesClientConfigMapPropertySourceLocator(api, @@ -159,7 +161,7 @@ void namedTwoConfigMapsOneFails(CapturedOutput output) { ConfigMapConfigProperties configMapConfigProperties = new ConfigMapConfigProperties(true, List.of(), List.of(sourceOne, sourceTwo), Map.of(), true, null, namespace, false, true, false, - RetryProperties.DEFAULT, false); + RetryProperties.DEFAULT, NAMESPACE_BATCHED); CoreV1Api api = new CoreV1Api(); KubernetesClientConfigMapPropertySourceLocator locator = new KubernetesClientConfigMapPropertySourceLocator(api, @@ -205,7 +207,7 @@ void namedTwoConfigMapsBothFail(CapturedOutput output) { ConfigMapConfigProperties configMapConfigProperties = new ConfigMapConfigProperties(true, List.of(), List.of(sourceOne, sourceTwo), Map.of(), true, null, namespace, false, true, false, - RetryProperties.DEFAULT, false); + RetryProperties.DEFAULT, NAMESPACE_BATCHED); CoreV1Api api = new CoreV1Api(); KubernetesClientConfigMapPropertySourceLocator locator = new KubernetesClientConfigMapPropertySourceLocator(api, @@ -250,7 +252,7 @@ void labeledSingleConfigMapFails(CapturedOutput output) { ConfigMapConfigProperties configMapConfigProperties = new ConfigMapConfigProperties(true, List.of(), List.of(configMapSource), labels, true, null, namespace, false, true, false, RetryProperties.DEFAULT, - false); + NAMESPACE_BATCHED); CoreV1Api api = new CoreV1Api(); KubernetesClientConfigMapPropertySourceLocator locator = new KubernetesClientConfigMapPropertySourceLocator(api, @@ -303,7 +305,7 @@ void labeledTwoConfigMapsOneFails(CapturedOutput output) { ConfigMapConfigProperties configMapConfigProperties = new ConfigMapConfigProperties(true, List.of(), List.of(sourceOne, sourceTwo), Map.of("one", "1", "two", "2"), true, null, namespace, false, true, - false, RetryProperties.DEFAULT, false); + false, RetryProperties.DEFAULT, NAMESPACE_BATCHED); CoreV1Api api = new CoreV1Api(); KubernetesClientConfigMapPropertySourceLocator locator = new KubernetesClientConfigMapPropertySourceLocator(api, @@ -358,7 +360,7 @@ void labeledTwoConfigMapsBothFail(CapturedOutput output) { ConfigMapConfigProperties configMapConfigProperties = new ConfigMapConfigProperties(true, List.of(), List.of(sourceOne, sourceTwo), Map.of("one", "1", "two", "2"), true, null, namespace, false, true, - false, RetryProperties.DEFAULT, false); + false, RetryProperties.DEFAULT, NAMESPACE_BATCHED); CoreV1Api api = new CoreV1Api(); KubernetesClientConfigMapPropertySourceLocator locator = new KubernetesClientConfigMapPropertySourceLocator(api, diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapErrorOnReadingSourceTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapErrorOnReadingSourceTests.java index bd95a7e81..e500a77cd 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapErrorOnReadingSourceTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapErrorOnReadingSourceTests.java @@ -50,6 +50,8 @@ @ExtendWith(OutputCaptureExtension.class) class Fabric8ConfigMapErrorOnReadingSourceTests { + private static final boolean NAMESPACED_BATCHED = true; + private static KubernetesMockServer mockServer; private static KubernetesClient mockClient; @@ -74,7 +76,7 @@ void namedSingleConfigMapFails() { mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").once(); ConfigMapConfigProperties configMapConfigProperties = new ConfigMapConfigProperties(true, List.of(), List.of(), - Map.of(), true, name, namespace, false, true, false, RetryProperties.DEFAULT, false); + Map.of(), true, name, namespace, false, true, false, RetryProperties.DEFAULT, NAMESPACED_BATCHED); Fabric8ConfigMapPropertySourceLocator locator = new Fabric8ConfigMapPropertySourceLocator(mockClient, configMapConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment())); @@ -115,7 +117,7 @@ void namedTwoConfigMapsOneFails() { ConfigMapConfigProperties configMapConfigProperties = new ConfigMapConfigProperties(true, List.of(), List.of(sourceOne, sourceTwo), Map.of(), true, null, namespace, false, true, false, - RetryProperties.DEFAULT, false); + RetryProperties.DEFAULT, NAMESPACED_BATCHED); Fabric8ConfigMapPropertySourceLocator locator = new Fabric8ConfigMapPropertySourceLocator(mockClient, configMapConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment())); @@ -150,7 +152,7 @@ void namedTwoConfigMapsBothFail() { ConfigMapConfigProperties configMapConfigProperties = new ConfigMapConfigProperties(true, List.of(), List.of(sourceOne, sourceTwo), Map.of(), true, null, namespace, false, true, false, - RetryProperties.DEFAULT, false); + RetryProperties.DEFAULT, NAMESPACED_BATCHED); Fabric8ConfigMapPropertySourceLocator locator = new Fabric8ConfigMapPropertySourceLocator(mockClient, configMapConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment())); @@ -183,7 +185,7 @@ void labeledSingleConfigMapFails(CapturedOutput output) { ConfigMapConfigProperties configMapConfigProperties = new ConfigMapConfigProperties(true, List.of(), List.of(configMapSource), labels, true, null, namespace, false, true, false, RetryProperties.DEFAULT, - false); + NAMESPACED_BATCHED); Fabric8ConfigMapPropertySourceLocator locator = new Fabric8ConfigMapPropertySourceLocator(mockClient, configMapConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment())); @@ -229,7 +231,7 @@ void labeledTwoConfigMapsOneFails(CapturedOutput output) { ConfigMapConfigProperties configMapConfigProperties = new ConfigMapConfigProperties(true, List.of(), List.of(sourceOne, sourceTwo), Map.of("one", "1", "two", "2"), true, null, namespace, false, true, - false, RetryProperties.DEFAULT, false); + false, RetryProperties.DEFAULT, NAMESPACED_BATCHED); Fabric8ConfigMapPropertySourceLocator locator = new Fabric8ConfigMapPropertySourceLocator(mockClient, configMapConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment())); @@ -269,7 +271,7 @@ void labeledTwoConfigMapsBothFail(CapturedOutput output) { ConfigMapConfigProperties configMapConfigProperties = new ConfigMapConfigProperties(true, List.of(), List.of(sourceOne, sourceTwo), Map.of("one", "1", "two", "2"), true, null, namespace, false, true, - false, RetryProperties.DEFAULT, false); + false, RetryProperties.DEFAULT, NAMESPACED_BATCHED); Fabric8ConfigMapPropertySourceLocator locator = new Fabric8ConfigMapPropertySourceLocator(mockClient, configMapConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment())); diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretErrorOnReadingSourceTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretErrorOnReadingSourceTests.java index 74b370040..c8d33e3cc 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretErrorOnReadingSourceTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretErrorOnReadingSourceTests.java @@ -50,6 +50,8 @@ @ExtendWith(OutputCaptureExtension.class) class Fabric8SecretErrorOnReadingSourceTests { + private static final boolean NAMESPACED_BATCHED = true; + private static KubernetesMockServer mockServer; private static KubernetesClient mockClient; @@ -74,7 +76,7 @@ void namedSingleSecretFails(CapturedOutput output) { mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").once(); SecretsConfigProperties secretsConfigProperties = new SecretsConfigProperties(true, Map.of(), List.of(), - List.of(), true, name, namespace, false, true, false, RetryProperties.DEFAULT, false); + List.of(), true, name, namespace, false, true, false, RetryProperties.DEFAULT, NAMESPACED_BATCHED); Fabric8SecretsPropertySourceLocator locator = new Fabric8SecretsPropertySourceLocator(mockClient, secretsConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment())); @@ -114,7 +116,7 @@ void namedTwoSecretsOneFails() { SecretsConfigProperties secretsConfigProperties = new SecretsConfigProperties(true, Map.of(), List.of(), List.of(sourceOne, sourceTwo), true, null, namespace, false, true, false, RetryProperties.DEFAULT, - false); + NAMESPACED_BATCHED); Fabric8SecretsPropertySourceLocator locator = new Fabric8SecretsPropertySourceLocator(mockClient, secretsConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment())); @@ -149,7 +151,7 @@ void namedTwoSecretsBothFail() { SecretsConfigProperties secretsConfigProperties = new SecretsConfigProperties(true, Map.of(), List.of(), List.of(sourceOne, sourceTwo), true, null, namespace, false, true, false, RetryProperties.DEFAULT, - false); + NAMESPACED_BATCHED); Fabric8SecretsPropertySourceLocator locator = new Fabric8SecretsPropertySourceLocator(mockClient, secretsConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment())); @@ -182,7 +184,7 @@ void labeledSingleSecretFails(CapturedOutput output) { SecretsConfigProperties secretsConfigProperties = new SecretsConfigProperties(true, labels, List.of(), List.of(secretSource), true, null, namespace, false, true, false, RetryProperties.DEFAULT, - false); + NAMESPACED_BATCHED); Fabric8SecretsPropertySourceLocator locator = new Fabric8SecretsPropertySourceLocator(mockClient, secretsConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment())); @@ -228,7 +230,7 @@ void labeledTwoSecretsOneFails(CapturedOutput output) { SecretsConfigProperties secretsConfigProperties = new SecretsConfigProperties(true, Map.of("one", "1", "two", "2"), List.of(), List.of(sourceOne, sourceTwo), true, null, namespace, false, - true, false, RetryProperties.DEFAULT, false); + true, false, RetryProperties.DEFAULT, NAMESPACED_BATCHED); Fabric8SecretsPropertySourceLocator locator = new Fabric8SecretsPropertySourceLocator(mockClient, secretsConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment())); @@ -268,7 +270,7 @@ void labeledTwoConfigMapsBothFail(CapturedOutput output) { SecretsConfigProperties secretsConfigProperties = new SecretsConfigProperties(true, Map.of("one", "1", "two", "2"), List.of(), List.of(sourceOne, sourceTwo), true, null, namespace, false, - true, false, RetryProperties.DEFAULT, false); + true, false, RetryProperties.DEFAULT, NAMESPACED_BATCHED); Fabric8SecretsPropertySourceLocator locator = new Fabric8SecretsPropertySourceLocator(mockClient, secretsConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment()));