Skip to content

Commit 7845498

Browse files
committed
Merge branch 'fix-1715-drop-profiles-support' into fix-1681
2 parents fadda04 + 390cbfd commit 7845498

File tree

5 files changed

+17
-40
lines changed

5 files changed

+17
-40
lines changed

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ void testSecretDataByLabelsThreeSecretsFound() {
190190

191191
MultipleSourcesContainer result = Fabric8ConfigUtils.secretsDataByLabels(client, "spring-k8s",
192192
Map.of("tag", "fit", "color", "blue"), new MockEnvironment());
193-
Assertions.assertThat(result.names()).contains("blue-circle-secret");
194-
Assertions.assertThat(result.names()).contains("blue-square-secret");
193+
Assertions.assertThat(result.names()).containsExactlyInAnyOrder("blue-circle-secret", "blue-square-secret");
195194

196195
@SuppressWarnings("unchecked")
197196
Map<String, Object> dataBlueSecret = (Map<String, Object>) result.data().get("blue-circle-secret");
@@ -201,10 +200,6 @@ void testSecretDataByLabelsThreeSecretsFound() {
201200
Map<String, Object> dataSquareSecret = (Map<String, Object>) result.data().get("blue-square-secret");
202201
Assertions.assertThat(dataSquareSecret).containsExactlyInAnyOrderEntriesOf(Map.of("two", "2"));
203202

204-
@SuppressWarnings("unchecked")
205-
Map<String, Object> dataSquareSecretK8s = (Map<String, Object>) result.data().get("blue-square-secret-k8s");
206-
Assertions.assertThat(dataSquareSecretK8s).containsExactlyInAnyOrderEntriesOf(Map.of("four", "4"));
207-
208203
}
209204

210205
// secret "my-secret" is deployed; we search for it by name and do not find it.

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,6 @@ void searchWithLabelsOneConfigMapFound() {
380380
}
381381

382382
/**
383-
<<<<<<< HEAD
384-
=======
385383
* two configmaps are deployed: "color-configmap" with label: "{color:blue}" and
386384
* "color-configmap-k8s" with label: "{color:red}". We search by "{color:blue}" and
387385
* find one configmap. Since profiles are enabled, we will also be reading
@@ -415,15 +413,13 @@ void searchWithLabelsOneConfigMapFoundAndOneFromProfileFound() {
415413
Fabric8ContextToSourceData data = new LabeledConfigMapContextToSourceDataProvider().get();
416414
SourceData sourceData = data.apply(context);
417415

418-
assertThat(sourceData.sourceData().size()).isEqualTo(2);
416+
assertThat(sourceData.sourceData().size()).isEqualTo(1);
419417
assertThat(sourceData.sourceData().get("color-configmap.one")).isEqualTo("1");
420-
assertThat(sourceData.sourceData().get("color-configmap-k8s.two")).isEqualTo("2");
421-
assertThat(sourceData.sourceName()).isEqualTo("configmap.color-configmap.color-configmap-k8s.default");
418+
assertThat(sourceData.sourceName()).isEqualTo("configmap.color-configmap.default");
422419

423420
}
424421

425422
/**
426-
>>>>>>> main
427423
* <pre>
428424
* - configmap "color-configmap" with label "{color:blue}"
429425
* - configmap "shape-configmap" with labels "{color:blue, shape:round}"
@@ -485,15 +481,12 @@ void searchWithLabelsTwoConfigMapsFound() {
485481
Fabric8ContextToSourceData data = new LabeledConfigMapContextToSourceDataProvider().get();
486482
SourceData sourceData = data.apply(context);
487483

488-
assertThat(sourceData.sourceData().size()).isEqualTo(4);
484+
assertThat(sourceData.sourceData().size()).isEqualTo(2);
489485

490486
assertThat(sourceData.sourceData().get("color-configmap.one")).isEqualTo("1");
491487
assertThat(sourceData.sourceData().get("shape-configmap.two")).isEqualTo("2");
492-
assertThat(sourceData.sourceData().get("color-configmap-k8s.four")).isEqualTo("4");
493-
assertThat(sourceData.sourceData().get("shape-configmap-k8s.five")).isEqualTo("5");
494488

495-
assertThat(sourceData.sourceName())
496-
.isEqualTo("configmap.color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.default");
489+
assertThat(sourceData.sourceName()).isEqualTo("configmap.color-configmap.shape-configmap.default");
497490

498491
}
499492

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,6 @@ void searchWithLabelsOneSecretFound() {
380380
}
381381

382382
/**
383-
<<<<<<< HEAD
384-
=======
385383
* two secrets are deployed: secret "color-secret" with label: "{color:blue}" and
386384
* "color-secret-k8s" with label: "{color:red}". We search by "{color:blue}" and find
387385
* one secret. Since profiles are enabled, we will also be reading "color-secret-k8s",
@@ -415,15 +413,13 @@ void searchWithLabelsOneSecretFoundAndOneFromProfileFound() {
415413
Fabric8ContextToSourceData data = new LabeledSecretContextToSourceDataProvider().get();
416414
SourceData sourceData = data.apply(context);
417415

418-
Assertions.assertThat(sourceData.sourceData().size()).isEqualTo(2);
416+
Assertions.assertThat(sourceData.sourceData().size()).isEqualTo(1);
419417
Assertions.assertThat(sourceData.sourceData().get("color-secret.one")).isEqualTo("1");
420-
Assertions.assertThat(sourceData.sourceData().get("color-secret-k8s.two")).isEqualTo("2");
421-
Assertions.assertThat(sourceData.sourceName()).isEqualTo("secret.color-secret.color-secret-k8s.default");
418+
Assertions.assertThat(sourceData.sourceName()).isEqualTo("secret.color-secret.default");
422419

423420
}
424421

425422
/**
426-
>>>>>>> main
427423
* <pre>
428424
* - secret "color-secret" with label "{color:blue}"
429425
* - secret "shape-secret" with labels "{color:blue, shape:round}"
@@ -485,14 +481,11 @@ void searchWithLabelsTwoSecretsFound() {
485481
Fabric8ContextToSourceData data = new LabeledSecretContextToSourceDataProvider().get();
486482
SourceData sourceData = data.apply(context);
487483

488-
Assertions.assertThat(sourceData.sourceData().size()).isEqualTo(4);
484+
Assertions.assertThat(sourceData.sourceData().size()).isEqualTo(2);
489485
assertThat(sourceData.sourceData().get("color-secret.one")).isEqualTo("1");
490486
assertThat(sourceData.sourceData().get("shape-secret.two")).isEqualTo("2");
491-
assertThat(sourceData.sourceData().get("color-secret-k8s.four")).isEqualTo("4");
492-
assertThat(sourceData.sourceData().get("shape-secret-k8s.five")).isEqualTo("5");
493487

494-
assertThat(sourceData.sourceName())
495-
.isEqualTo("secret.color-secret.color-secret-k8s.shape-secret.shape-secret-k8s.default");
488+
assertThat(sourceData.sourceName()).isEqualTo("secret.color-secret.shape-secret.default");
496489

497490
}
498491

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,11 @@ void testBlue() {
151151
}
152152

153153
/**
154-
<<<<<<< HEAD
155-
* <pre>
154+
* <<<<<<< HEAD <pre>
156155
* this one is taken from : "green-configmap.green-configmap-k8s.green-configmap-prod.green-purple-configmap.green-purple-configmap-k8s".
157156
* We find "green-configmap", "green-configmap-k8s", "green-configmap-prod" by labels.
158157
* Also "green-purple-configmap" and "green-purple-configmap-k8s" are found.
159-
* </pre>
160-
=======
161-
* found by labels.
162-
>>>>>>> main
158+
* </pre> ======= found by labels. >>>>>>> main
163159
*/
164160
@Test
165161
void testGreen() {

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ abstract class LabeledSecretWithProfile {
7575
* - secret with name "color-secret-k8s", with labels : "{color: not-blue}"
7676
* - secret with name "green-secret-k8s", with labels : "{color: green-k8s}"
7777
* - secret with name "green-secret-prod", with labels : "{color: green-prod}"
78-
<<<<<<< HEAD
79-
=======
78+
<<<<<<< HEAD
79+
=======
8080
*
8181
* a test that proves order: first read non-profile based secrets, thus profile based
8282
* secrets override non-profile ones.
83-
>>>>>>> main
83+
>>>>>>> main
8484
* - secret with name "green-purple-secret", labels "{color: green, shape: round}", data: "{eight: 8}"
8585
* - secret with name "green-purple-secret-k8s", labels "{color: black}", data: "{eight: eight-ish}"
8686
* </pre>
@@ -168,13 +168,13 @@ void testBlue() {
168168

169169
/**
170170
* <pre>
171-
<<<<<<< HEAD
171+
<<<<<<< HEAD
172172
* this one is taken from : "green-purple-secret.green-purple-secret-k8s.green-secret.green-secret-k8s.green-secret-prod".
173173
* We find "green-secret", "green-secrets-k8s" and "green-secrets-prod" by labels.
174174
* Also "green-purple-secret" and "green-purple-secret-k8s" are found.
175-
=======
175+
=======
176176
* We find "green-secret" by labels.
177-
>>>>>>> main
177+
>>>>>>> main
178178
* </pre>
179179
*/
180180
@Test

0 commit comments

Comments
 (0)