Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wind57 committed Nov 25, 2024
1 parent 2c6895d commit 8048d49
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
@ExtendWith(OutputCaptureExtension.class)
class Fabric8ConfigMapErrorOnReadingSourceTests {

private static final boolean NAMESPACED_BATCHED = true;

private static KubernetesMockServer mockServer;

private static KubernetesClient mockClient;
Expand All @@ -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()));
Expand Down Expand Up @@ -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()));
Expand Down Expand Up @@ -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()));
Expand Down Expand Up @@ -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()));
Expand Down Expand Up @@ -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()));
Expand Down Expand Up @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
@ExtendWith(OutputCaptureExtension.class)
class Fabric8SecretErrorOnReadingSourceTests {

private static final boolean NAMESPACED_BATCHED = true;

private static KubernetesMockServer mockServer;

private static KubernetesClient mockClient;
Expand All @@ -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()));
Expand Down Expand Up @@ -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()));
Expand Down Expand Up @@ -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()));
Expand Down Expand Up @@ -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()));
Expand Down Expand Up @@ -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()));
Expand Down Expand Up @@ -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()));
Expand Down

0 comments on commit 8048d49

Please sign in to comment.