Correct tests after fabric8 upgrade (#1374)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<String, String> 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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user