Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wind57 committed Jun 24, 2023
1 parent 236c6f1 commit 558d6e9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand All @@ -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.");
}
Expand All @@ -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));
}

Expand All @@ -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));
}

Expand Down

0 comments on commit 558d6e9

Please sign in to comment.