Skip to content

Commit

Permalink
Adapt tests to the new NameEnricher behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
pmf-test committed Mar 15, 2024
1 parent b082aab commit 04e48b5
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
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 04e48b5

Please sign in to comment.