Skip to content

Commit

Permalink
Adapt tests to the new NameEnricher behaviour
Browse files Browse the repository at this point in the history
Signed-off-by: Amirouche <amirouche.halfaoui@rakuten.com>
  • Loading branch information
pmf-test committed Mar 15, 2024
1 parent b082aab commit 50f3cc5
Showing 1 changed file with 16 additions and 2 deletions.
Expand Up @@ -118,7 +118,7 @@ void create_withAlreadyExistingName_shouldKeepExistingName() {
}

@Test
void create_withCustomNameAndAlreadyExistingName_shouldOverrideExistingName() {
void create_withCustomNameAndAlreadyExistingName_shouldKeepExistingName() {
// Given
klb = new KubernetesListBuilder();
properties.put("jkube.enricher.jkube-name.name", "custom-name");
Expand All @@ -128,6 +128,20 @@ void create_withCustomNameAndAlreadyExistingName_shouldOverrideExistingName() {
// Then
assertThat(klb.build().getItems())
.singleElement()
.hasFieldOrPropertyWithValue("metadata.name", "custom-name");
.hasFieldOrPropertyWithValue("metadata.name", "existing-name");
}

@Test
void create_withoutName_shouldSetGivenCustomName() {
// Given
klb = new KubernetesListBuilder();
properties.put("jkube.enricher.jkube-name.name", "custom-name");
// When
klb.addToItems(new ServiceBuilder().withNewMetadata().endMetadata().build());
new NameEnricher(context).create(PlatformMode.kubernetes, klb);
// Then
assertThat(klb.build().getItems())
.singleElement()
.hasFieldOrPropertyWithValue("metadata.name", "custom-name");
}
}

0 comments on commit 50f3cc5

Please sign in to comment.