Skip to content

Commit 379846c

Browse files
committed
fix test
Signed-off-by: wind57 <[email protected]>
1 parent 91265ac commit 379846c

File tree

1 file changed

+4
-60
lines changed

1 file changed

+4
-60
lines changed

spring-cloud-kubernetes-fabric8-config/src/test/java/org/springframework/cloud/kubernetes/fabric8/config/LabeledSecretContextToSourceDataProviderTests.java

Lines changed: 4 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -374,50 +374,6 @@ void searchWithLabelsOneSecretFound() {
374374
}
375375

376376
/**
377-
<<<<<<< HEAD
378-
=======
379-
* two secrets are deployed: secret "color-secret" with label: "{color:blue}" and
380-
* "color-secret-k8s" with label: "{color:red}". We search by "{color:blue}" and find
381-
* one secret. Since profiles are enabled, we will also be reading "color-secret-k8s",
382-
* even if its labels do not match provided ones.
383-
*/
384-
@Test
385-
void searchWithLabelsOneSecretFoundAndOneFromProfileFound() {
386-
Secret colorSecret = new SecretBuilder().withNewMetadata()
387-
.withName("color-secret")
388-
.withLabels(Collections.singletonMap("color", "blue"))
389-
.endMetadata()
390-
.addToData("one", Base64.getEncoder().encodeToString("1".getBytes()))
391-
.build();
392-
393-
Secret colorSecretK8s = new SecretBuilder().withNewMetadata()
394-
.withName("color-secret-k8s")
395-
.withLabels(Collections.singletonMap("color", "red"))
396-
.endMetadata()
397-
.addToData("two", Base64.getEncoder().encodeToString("2".getBytes()))
398-
.build();
399-
400-
mockClient.secrets().inNamespace(NAMESPACE).resource(colorSecret).create();
401-
mockClient.secrets().inNamespace(NAMESPACE).resource(colorSecretK8s).create();
402-
MockEnvironment environment = new MockEnvironment();
403-
environment.setActiveProfiles("k8s");
404-
405-
NormalizedSource normalizedSource = new LabeledSecretNormalizedSource(NAMESPACE,
406-
Collections.singletonMap("color", "blue"), true, ConfigUtils.Prefix.DELAYED);
407-
Fabric8ConfigContext context = new Fabric8ConfigContext(mockClient, normalizedSource, NAMESPACE, environment);
408-
409-
Fabric8ContextToSourceData data = new LabeledSecretContextToSourceDataProvider().get();
410-
SourceData sourceData = data.apply(context);
411-
412-
Assertions.assertThat(sourceData.sourceData().size()).isEqualTo(2);
413-
Assertions.assertThat(sourceData.sourceData().get("color-secret.color-secret-k8s.one")).isEqualTo("1");
414-
Assertions.assertThat(sourceData.sourceData().get("color-secret.color-secret-k8s.two")).isEqualTo("2");
415-
Assertions.assertThat(sourceData.sourceName()).isEqualTo("secret.color-secret.color-secret-k8s.default");
416-
417-
}
418-
419-
/**
420-
>>>>>>> main
421377
* <pre>
422378
* - secret "color-secret" with label "{color:blue}"
423379
* - secret "shape-secret" with labels "{color:blue, shape:round}"
@@ -478,22 +434,10 @@ void searchWithLabelsTwoSecretsFound() {
478434
Fabric8ContextToSourceData data = new LabeledSecretContextToSourceDataProvider().get();
479435
SourceData sourceData = data.apply(context);
480436

481-
Assertions.assertThat(sourceData.sourceData().size()).isEqualTo(4);
482-
Assertions
483-
.assertThat(sourceData.sourceData().get("color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.one"))
484-
.isEqualTo("1");
485-
Assertions
486-
.assertThat(sourceData.sourceData().get("color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.two"))
487-
.isEqualTo("2");
488-
Assertions
489-
.assertThat(sourceData.sourceData().get("color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.four"))
490-
.isEqualTo("4");
491-
Assertions
492-
.assertThat(sourceData.sourceData().get("color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.five"))
493-
.isEqualTo("5");
494-
495-
Assertions.assertThat(sourceData.sourceName())
496-
.isEqualTo("secret.color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.default");
437+
Assertions.assertThat(sourceData.sourceData().size()).isEqualTo(2);
438+
Assertions.assertThat(sourceData.sourceData().get("color-secret.shape-secret.one")).isEqualTo("1");
439+
Assertions.assertThat(sourceData.sourceData().get("color-secret.shape-secret.two")).isEqualTo("2");
440+
Assertions.assertThat(sourceData.sourceName()).isEqualTo("secret.color-secret.shape-secret.default");
497441

498442
}
499443

0 commit comments

Comments
 (0)