From 558d6e93c3313de82a6e3bbf663892ed60a42674 Mon Sep 17 00:00:00 2001 From: wind57 Date: Sat, 24 Jun 2023 19:41:33 +0300 Subject: [PATCH] fix tests --- .../Fabric8ConfigMapPropertySourceLocatorTests.java | 4 ++-- .../config/Fabric8ConfigMapPropertySourceTests.java | 4 ++-- .../config/Fabric8SecretsPropertySourceLocatorTests.java | 4 ++-- .../config/Fabric8SecretsPropertySourceMockTests.java | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) 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 6a1a8c66f8..72c6923a7d 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 @@ void locateShouldThrowExceptionOnFailureWhenFailFastIsEnabled() { 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); @@ -66,7 +66,7 @@ void locateShouldNotThrowExceptionOnFailureWhenFailFastIsDisabled() { 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, 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 3b3095a079..2f1983254e 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,7 +53,7 @@ void constructorShouldThrowExceptionOnFailureWhenFailFastIsEnabled() { 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) @@ -66,7 +66,7 @@ void constructorShouldNotThrowExceptionOnFailureWhenFailFastIsDisabled() { 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 24c771e312..871cea4f67 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 @@ void locateShouldThrowExceptionOnFailureWhenFailFastIsEnabled() { 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); @@ -66,7 +66,7 @@ void locateShouldNotThrowExceptionOnFailureWhenFailFastIsDisabled() { 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 fc7a5f821c..74de092266 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 @@ -52,7 +52,7 @@ void namedStrategyShouldThrowExceptionOnFailureWhenFailFastIsEnabled() { NamedSecretNormalizedSource named = new NamedSecretNormalizedSource(name, namespace, true, false); 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: Internal Server Error."); @@ -67,7 +67,7 @@ void labeledStrategyShouldThrowExceptionOnFailureWhenFailFastIsEnabled() { 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: Internal Server Error."); } @@ -81,7 +81,7 @@ void namedStrategyShouldNotThrowExceptionOnFailureWhenFailFastIsDisabled() { 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)); } @@ -94,7 +94,7 @@ void labeledStrategyShouldNotThrowExceptionOnFailureWhenFailFastIsDisabled() { 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)); }