diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapPropertySourceLocatorTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapPropertySourceLocatorTests.java index ae101846..72c6923a 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapPropertySourceLocatorTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapPropertySourceLocatorTests.java @@ -48,7 +48,7 @@ class Fabric8ConfigMapPropertySourceLocatorTests { String namespace = "default"; String path = "/api/v1/namespaces/default/configmaps"; - mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").once(); + mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").always(); ConfigMapConfigProperties configMapConfigProperties = new ConfigMapConfigProperties(true, List.of(), List.of(), Map.of(), true, name, namespace, false, true, true, RetryProperties.DEFAULT); @@ -57,16 +57,16 @@ class Fabric8ConfigMapPropertySourceLocatorTests { configMapConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment())); assertThatThrownBy(() -> locator.locate(new MockEnvironment())).isInstanceOf(IllegalStateException.class) - .hasMessageContaining("api/v1/namespaces/default/configmaps. Message: Not Found."); + .hasMessageContaining("api/v1/namespaces/default/configmaps. Message: Internal Server Error."); } @Test void locateShouldNotThrowExceptionOnFailureWhenFailFastIsDisabled() { String name = "my-config"; String namespace = "default"; - String path = "/api/v1/namespaces/default/configmaps/my-config"; + String path = "/api/v1/namespaces/default/configmaps"; - mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").once(); + mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").always(); ConfigMapConfigProperties configMapConfigProperties = new ConfigMapConfigProperties(true, List.of(), List.of(), Map.of(), true, name, namespace, false, true, false, RetryProperties.DEFAULT); diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapPropertySourceTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapPropertySourceTests.java index 3f5c337f..2f198325 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapPropertySourceTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8ConfigMapPropertySourceTests.java @@ -53,11 +53,11 @@ class Fabric8ConfigMapPropertySourceTests { String namespace = "default"; String path = String.format("/api/v1/namespaces/%s/configmaps", namespace); - mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").once(); + mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").always(); NormalizedSource source = new NamedConfigMapNormalizedSource(name, namespace, true, DEFAULT, true); Fabric8ConfigContext context = new Fabric8ConfigContext(mockClient, source, "default", new MockEnvironment()); assertThatThrownBy(() -> new Fabric8ConfigMapPropertySource(context)).isInstanceOf(IllegalStateException.class) - .hasMessageContaining("v1/namespaces/default/configmaps. Message: Not Found."); + .hasMessageContaining("v1/namespaces/default/configmaps. Message: Internal Server Error."); } @Test @@ -66,7 +66,7 @@ class Fabric8ConfigMapPropertySourceTests { String namespace = "default"; String path = String.format("/api/v1/namespaces/%s/configmaps/%s", namespace, name); - mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").once(); + mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").always(); NormalizedSource source = new NamedConfigMapNormalizedSource(name, namespace, false, false); Fabric8ConfigContext context = new Fabric8ConfigContext(mockClient, source, "", new MockEnvironment()); assertThatNoException().isThrownBy(() -> new Fabric8ConfigMapPropertySource(context)); diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceLocatorTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceLocatorTests.java index c55bdd6c..871cea4f 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceLocatorTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceLocatorTests.java @@ -48,7 +48,7 @@ class Fabric8SecretsPropertySourceLocatorTests { String namespace = "default"; String path = "/api/v1/namespaces/default/secrets"; - mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").once(); + mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").always(); SecretsConfigProperties configMapConfigProperties = new SecretsConfigProperties(true, Map.of(), List.of(), List.of(), true, name, namespace, false, true, true, RetryProperties.DEFAULT); @@ -57,7 +57,7 @@ class Fabric8SecretsPropertySourceLocatorTests { configMapConfigProperties, new KubernetesNamespaceProvider(new MockEnvironment())); assertThatThrownBy(() -> locator.locate(new MockEnvironment())).isInstanceOf(IllegalStateException.class) - .hasMessageContaining("v1/namespaces/default/secrets. Message: Not Found."); + .hasMessageContaining("v1/namespaces/default/secrets. Message: Internal Server Error."); } @Test @@ -66,7 +66,7 @@ class Fabric8SecretsPropertySourceLocatorTests { String namespace = "default"; String path = "/api/v1/namespaces/default/secrets/my-secret"; - mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").once(); + mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").always(); SecretsConfigProperties configMapConfigProperties = new SecretsConfigProperties(true, Map.of(), List.of(), List.of(), true, name, namespace, false, true, false, RetryProperties.DEFAULT); diff --git a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceMockTests.java b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceMockTests.java index 089a1a4f..74de0922 100644 --- a/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceMockTests.java +++ b/spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/Fabric8SecretsPropertySourceMockTests.java @@ -45,17 +45,17 @@ class Fabric8SecretsPropertySourceMockTests { @Test void namedStrategyShouldThrowExceptionOnFailureWhenFailFastIsEnabled() { - final String name = "my-config"; + final String name = "my-secret"; final String namespace = "default"; - final String path = String.format("/api/v1/namespaces/%s/secrets/%s", namespace, name); + final String path = String.format("/api/v1/namespaces/%s/secrets", namespace); NamedSecretNormalizedSource named = new NamedSecretNormalizedSource(name, namespace, true, false); - Fabric8ConfigContext context = new Fabric8ConfigContext(client, named, "default", new MockEnvironment()); + Fabric8ConfigContext context = new Fabric8ConfigContext(client, named, namespace, new MockEnvironment()); - mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").once(); + mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").always(); assertThatThrownBy(() -> new Fabric8SecretsPropertySource(context)).isInstanceOf(IllegalStateException.class) .hasMessageContaining("Failure executing: GET at: https://localhost:") - .hasMessageContaining("api/v1/namespaces/default/secrets. Message: Not Found."); + .hasMessageContaining("api/v1/namespaces/default/secrets. Message: Internal Server Error."); } @Test @@ -67,21 +67,21 @@ class Fabric8SecretsPropertySourceMockTests { LabeledSecretNormalizedSource labeled = new LabeledSecretNormalizedSource(namespace, labels, true, false); Fabric8ConfigContext context = new Fabric8ConfigContext(client, labeled, "default", new MockEnvironment()); - mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").once(); + mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").always(); assertThatThrownBy(() -> new Fabric8SecretsPropertySource(context)).isInstanceOf(IllegalStateException.class) - .hasMessageContaining("api/v1/namespaces/default/secrets. Message: Not Found."); + .hasMessageContaining("api/v1/namespaces/default/secrets. Message: Internal Server Error."); } @Test void namedStrategyShouldNotThrowExceptionOnFailureWhenFailFastIsDisabled() { - final String name = "my-config"; + final String name = "my-secret"; final String namespace = "default"; - final String path = String.format("/api/v1/namespaces/%s/secrets/%s", namespace, name); + final String path = String.format("/api/v1/namespaces/%s/secrets", namespace); NamedSecretNormalizedSource named = new NamedSecretNormalizedSource(name, namespace, false, false); Fabric8ConfigContext context = new Fabric8ConfigContext(client, named, "default", new MockEnvironment()); - mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").once(); + mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").always(); assertThatNoException().isThrownBy(() -> new Fabric8SecretsPropertySource(context)); } @@ -89,12 +89,12 @@ class Fabric8SecretsPropertySourceMockTests { void labeledStrategyShouldNotThrowExceptionOnFailureWhenFailFastIsDisabled() { final String namespace = "default"; final Map labels = Collections.singletonMap("a", "b"); - final String path = String.format("/api/v1/namespaces/%s/secrets?labelSelector=", namespace) + "a%3Db"; + final String path = String.format("/api/v1/namespaces/%s/secrets", namespace); LabeledSecretNormalizedSource labeled = new LabeledSecretNormalizedSource(namespace, labels, false, false); Fabric8ConfigContext context = new Fabric8ConfigContext(client, labeled, "default", new MockEnvironment()); - mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").once(); + mockServer.expect().withPath(path).andReturn(500, "Internal Server Error").always(); assertThatNoException().isThrownBy(() -> new Fabric8SecretsPropertySource(context)); }