@@ -377,49 +377,6 @@ void searchWithLabelsOneConfigMapFound() {
377377
378378 }
379379
380- /**
381- * two configmaps are deployed: "color-configmap" with label: "{color:blue}" and
382- * "color-configmap-k8s" with label: "{color:red}". We search by "{color:blue}" and
383- * find one configmap. Since profiles are enabled, we will also be reading
384- * "color-configmap-k8s", even if its labels do not match provided ones.
385- */
386- @ Test
387- void searchWithLabelsOneConfigMapFoundAndOneFromProfileFound () {
388- ConfigMap colorConfigmap = new ConfigMapBuilder ().withNewMetadata ()
389- .withName ("color-configmap" )
390- .withLabels (Collections .singletonMap ("color" , "blue" ))
391- .endMetadata ()
392- .addToData ("one" , "1" )
393- .build ();
394-
395- ConfigMap colorConfigmapK8s = new ConfigMapBuilder ().withNewMetadata ()
396- .withName ("color-configmap-k8s" )
397- .withLabels (Collections .singletonMap ("color" , "red" ))
398- .endMetadata ()
399- .addToData ("two" , "2" )
400- .build ();
401-
402- mockClient .configMaps ().inNamespace (NAMESPACE ).resource (colorConfigmap ).create ();
403- mockClient .configMaps ().inNamespace (NAMESPACE ).resource (colorConfigmapK8s ).create ();
404- MockEnvironment environment = new MockEnvironment ();
405- environment .setActiveProfiles ("k8s" );
406-
407- NormalizedSource normalizedSource = new LabeledConfigMapNormalizedSource (NAMESPACE ,
408- Collections .singletonMap ("color" , "blue" ), true , ConfigUtils .Prefix .DELAYED , true );
409- Fabric8ConfigContext context = new Fabric8ConfigContext (mockClient , normalizedSource , NAMESPACE , environment ,
410- true );
411-
412- Fabric8ContextToSourceData data = new LabeledConfigMapContextToSourceDataProvider ().get ();
413- SourceData sourceData = data .apply (context );
414-
415- Assertions .assertThat (sourceData .sourceData ().size ()).isEqualTo (2 );
416- Assertions .assertThat (sourceData .sourceData ().get ("color-configmap.color-configmap-k8s.one" )).isEqualTo ("1" );
417- Assertions .assertThat (sourceData .sourceData ().get ("color-configmap.color-configmap-k8s.two" )).isEqualTo ("2" );
418- Assertions .assertThat (sourceData .sourceName ())
419- .isEqualTo ("configmap.color-configmap.color-configmap-k8s.default" );
420-
421- }
422-
423380 /**
424381 * <pre>
425382 * - configmap "color-configmap" with label "{color:blue}"
@@ -482,26 +439,10 @@ void searchWithLabelsTwoConfigMapsFound() {
482439 Fabric8ContextToSourceData data = new LabeledConfigMapContextToSourceDataProvider ().get ();
483440 SourceData sourceData = data .apply (context );
484441
485- Assertions .assertThat (sourceData .sourceData ().size ()).isEqualTo (4 );
486- Assertions
487- .assertThat (sourceData .sourceData ()
488- .get ("color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.one" ))
489- .isEqualTo ("1" );
490- Assertions
491- .assertThat (sourceData .sourceData ()
492- .get ("color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.two" ))
493- .isEqualTo ("2" );
494- Assertions
495- .assertThat (sourceData .sourceData ()
496- .get ("color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.four" ))
497- .isEqualTo ("4" );
498- Assertions
499- .assertThat (sourceData .sourceData ()
500- .get ("color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.five" ))
501- .isEqualTo ("5" );
502-
503- Assertions .assertThat (sourceData .sourceName ())
504- .isEqualTo ("configmap.color-configmap.color-configmap-k8s.shape-configmap.shape-configmap-k8s.default" );
442+ Assertions .assertThat (sourceData .sourceData ().size ()).isEqualTo (2 );
443+ Assertions .assertThat (sourceData .sourceData ().get ("color-configmap.shape-configmap.one" )).isEqualTo ("1" );
444+ Assertions .assertThat (sourceData .sourceData ().get ("color-configmap.shape-configmap.two" )).isEqualTo ("2" );
445+ Assertions .assertThat (sourceData .sourceName ()).isEqualTo ("configmap.color-configmap.shape-configmap.default" );
505446
506447 }
507448
@@ -544,7 +485,6 @@ void cache(CapturedOutput output) {
544485 Assertions .assertThat (redSourceData .sourceData ().size ()).isEqualTo (1 );
545486 Assertions .assertThat (redSourceData .sourceData ().get ("red-configmap.one" )).isEqualTo ("1" );
546487 Assertions .assertThat (output .getAll ()).contains ("Loaded all config maps in namespace '" + NAMESPACE + "'" );
547- Assertions .assertThat (output .getAll ()).contains ("Will read individual configmaps in namespace" );
548488
549489 NormalizedSource greenNormalizedSource = new LabeledConfigMapNormalizedSource (NAMESPACE ,
550490 Collections .singletonMap ("color" , "green" ), true , ConfigUtils .Prefix .DELAYED , true );
0 commit comments