Skip to content

Commit d760c99

Browse files
authored
Merge pull request #578 from oracle/develop-feature-rolling-restart-tests
Tests for rolling restart
2 parents 4e62fa8 + e12840e commit d760c99

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

operator/src/test/java/oracle/kubernetes/operator/helpers/AdminPodHelperTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,18 @@ public void whenPodHasCustomLabelConflictWithInternal_createAdminPodWithInternal
417417
assertThat(podLabels, hasEntry("label1", "server-label-value1"));
418418
}
419419

420+
@Test
421+
public void whenDomainAndAdminHasRestartVersion_createAdminPodWithRestartVersionLabel() {
422+
getConfigurator()
423+
.withRestartVersion("domainRestartV1")
424+
.configureAdminServer((ADMIN_SERVER))
425+
.withRestartVersion("adminRestartV1");
426+
427+
Map<String, String> podLabels = getCreatedPod().getMetadata().getLabels();
428+
assertThat(podLabels, hasEntry(LabelConstants.DOMAINRESTARTVERSION_LABEL, "domainRestartV1"));
429+
assertThat(podLabels, hasEntry(LabelConstants.SERVERRESTARTVERSION_LABEL, "adminRestartV1"));
430+
}
431+
420432
@Override
421433
protected void onAdminExpectListPersistentVolume() {
422434
expectListPersistentVolume().returning(createPersistentVolumeList());

operator/src/test/java/oracle/kubernetes/operator/helpers/ManagedPodHelperTest.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,14 @@ public void whenExistingManagedPodSpecContainerHasWrongEnvFrom_replaceIt() {
209209
verifyRollManagedPodWhen((pod) -> getSpecContainer(pod).envFrom(Collections.emptyList()));
210210
}
211211

212+
@Test
213+
public void whenExistingManagedPodRestartVersionChange() {
214+
verifyRollManagedPodWhen(
215+
(pod) ->
216+
pod.getMetadata()
217+
.putLabelsItem(LabelConstants.SERVERRESTARTVERSION_LABEL, "serverRestartV1"));
218+
}
219+
212220
@Test
213221
public void whenDomainHasAdditionalVolumes_createManagedPodWithThem() {
214222
getConfigurator()
@@ -362,6 +370,24 @@ public void whenClusterHasLabels_createManagedPodWithThem() {
362370
assertThat(podLabels, hasEntry("label2", "cluster-label-value2"));
363371
}
364372

373+
@Test
374+
public void whenClusterHasRestartVersion_createManagedPodWithRestartVersionLabel() {
375+
testSupport.addToPacket(ProcessingConstants.CLUSTER_NAME, CLUSTER_NAME);
376+
getConfigurator().configureCluster(CLUSTER_NAME).withRestartVersion("clusterRestartV1");
377+
378+
Map<String, String> podLabels = getCreatedPod().getMetadata().getLabels();
379+
assertThat(podLabels, hasEntry(LabelConstants.CLUSTERRESTARTVERSION_LABEL, "clusterRestartV1"));
380+
}
381+
382+
@Test
383+
public void whenDomainHasRestartVersion_createManagedPodWithRestartVersionLabel() {
384+
testSupport.addToPacket(ProcessingConstants.CLUSTER_NAME, CLUSTER_NAME);
385+
getConfigurator().withRestartVersion("domainRestartV1");
386+
387+
Map<String, String> podLabels = getCreatedPod().getMetadata().getLabels();
388+
assertThat(podLabels, hasEntry(LabelConstants.DOMAINRESTARTVERSION_LABEL, "domainRestartV1"));
389+
}
390+
365391
@Test
366392
public void whenClusterHasAnnotations_createManagedPodWithThem() {
367393
testSupport.addToPacket(ProcessingConstants.CLUSTER_NAME, CLUSTER_NAME);

0 commit comments

Comments
 (0)