Skip to content

Commit 06bcf65

Browse files
sankarpnrjeberhard
authored andcommitted
Use the kubectl exec command instead of java api to get the status of
pods. Apparently the java api's are not reliable to get the pod status
1 parent c25cf3e commit 06bcf65

File tree

1 file changed

+12
-27
lines changed

1 file changed

+12
-27
lines changed

integration-tests/src/test/java/oracle/kubernetes/operator/ITPodsRestart.java

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -356,17 +356,14 @@ public void testAdminServerRestartVersion() throws Exception {
356356
ExecResult exec = TestUtils.exec("kubectl apply -f " + path.toString());
357357
logger.info(exec.stdout());
358358

359-
logger.info("Verifying if the admin server is terminating");
360-
verifyPodStatus(podName, "Terminating");
361-
verifyPodStatus(podName, "Running");
362-
359+
logger.info("Verifying if the admin server pod is recreated");
360+
domain.verifyAdminServerRestarted();
363361
} finally {
364362
logger.log(
365363
Level.INFO, "Reverting back the domain to old crd\n kubectl apply -f {0}", originalYaml);
366364
TestUtils.exec("kubectl apply -f " + originalYaml);
367-
logger.info("Verifying if the admin server is terminating");
368-
verifyPodStatus(podName, "Terminating");
369-
verifyPodStatus(podName, "Running");
365+
logger.info("Verifying if the admin server pod is recreated");
366+
domain.verifyAdminServerRestarted();
370367
}
371368
logger.log(Level.INFO, "SUCCESS - {0}", testMethodName);
372369
}
@@ -405,15 +402,13 @@ public void testClusterRestartVersion() throws Exception {
405402
ExecResult exec = TestUtils.exec("kubectl apply -f " + path.toString());
406403
logger.info(exec.stdout());
407404
logger.info("Verifying if the cluster is restarted");
408-
verifyPodStatus(podName, "Terminating");
409-
verifyPodStatus(podName, "Running");
405+
domain.verifyManagedServersRestarted();
410406
} finally {
411407
logger.log(
412408
Level.INFO, "Reverting back the domain to old crd\n kubectl apply -f {0}", originalYaml);
413409
TestUtils.exec("kubectl apply -f " + originalYaml);
414410
logger.info("Verifying if the cluster is restarted");
415-
verifyPodStatus(podName, "Terminating");
416-
verifyPodStatus(podName, "Running");
411+
domain.verifyManagedServersRestarted();
417412
}
418413
logger.log(Level.INFO, "SUCCESS - {0}", testMethodName);
419414
}
@@ -456,15 +451,13 @@ public void testMSRestartVersion() throws Exception {
456451
ExecResult exec = TestUtils.exec("kubectl apply -f " + path.toString());
457452
logger.info(exec.stdout());
458453
logger.info("Verifying if the managed server is restarted");
459-
verifyPodStatus(podName, "Terminating");
460-
verifyPodStatus(podName, "Running");
454+
domain.verifyManagedServersRestarted();
461455
} finally {
462456
logger.log(
463457
Level.INFO, "Reverting back the domain to old crd\n kubectl apply -f {0}", originalYaml);
464458
TestUtils.exec("kubectl apply -f " + originalYaml);
465459
logger.info("Verifying if the managed server is restarted");
466-
verifyPodStatus(podName, "Terminating");
467-
verifyPodStatus(podName, "Running");
460+
domain.verifyManagedServersRestarted();
468461
}
469462
logger.log(Level.INFO, "SUCCESS - {0}", testMethodName);
470463
}
@@ -504,23 +497,15 @@ public void testDomainRestartVersion() throws Exception {
504497
ExecResult exec = TestUtils.exec("kubectl apply -f " + path.toString());
505498
logger.info(exec.stdout());
506499
logger.info("Verifying if the domain is restarted");
507-
logger.info("Verifying if the admin server is restarted");
508-
verifyPodStatus(adminPod, "Terminating");
509-
verifyPodStatus(adminPod, "Running");
510-
logger.info("Verifying if the managed server is restarted");
511-
verifyPodStatus(msPod, "Terminating");
512-
verifyPodStatus(msPod, "Running");
500+
this.domain.verifyAdminServerRestarted();
501+
this.domain.verifyManagedServersRestarted();
513502
} finally {
514503
logger.log(
515504
Level.INFO, "Reverting back the domain to old crd\n kubectl apply -f {0}", originalYaml);
516505
TestUtils.exec("kubectl apply -f " + originalYaml);
517506
logger.info("Verifying if the domain is restarted");
518-
logger.info("Verifying if the admin server is restarted");
519-
verifyPodStatus(adminPod, "Terminating");
520-
verifyPodStatus(adminPod, "Running");
521-
logger.info("Verifying if the managed server is restarted");
522-
verifyPodStatus(msPod, "Terminating");
523-
verifyPodStatus(msPod, "Running");
507+
this.domain.verifyAdminServerRestarted();
508+
this.domain.verifyManagedServersRestarted();
524509
}
525510
logger.log(Level.INFO, "SUCCESS - {0}", testMethodName);
526511
}

0 commit comments

Comments
 (0)