@@ -325,10 +325,7 @@ public void testAdminServerRestartVersion() throws Exception {
325
325
Assume .assumeFalse (QUICKTEST );
326
326
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
327
327
logTestBegin (testMethodName );
328
- K8sTestUtils testUtil = new K8sTestUtils ();
329
- final String domainUid = domain .getDomainUid ();
330
- final String domain1LabelSelector = String .format ("weblogic.domainUID in (%s)" , domainUid );
331
- final String podName = domain .getDomainUid () + "-" + domain .getAdminServerName ();
328
+ String podName = domainUid + "-" + domain .getAdminServerName ();
332
329
333
330
try {
334
331
// Modify the original domain yaml to include restartVersion in admin server node
@@ -349,22 +346,18 @@ public void testAdminServerRestartVersion() throws Exception {
349
346
logger .log (Level .INFO , "kubectl apply -f {0}" , path .toString ());
350
347
ExecResult exec = TestUtils .exec ("kubectl apply -f " + path .toString ());
351
348
logger .info (exec .stdout ());
352
- logger .info ("Verifying if the admin server is restarted" );
353
- for (int i = 0 ; i < 120000 ; i = i + 10000 ) {
354
- String podStatus =
355
- testUtil .getPodStatus (domain .getDomainNS (), domain1LabelSelector , podName );
356
- Thread .sleep (10000 );
357
- }
349
+
350
+ logger .info ("Verifying if the admin server is terminating" );
351
+ verifyPodStatus (podName , "Terminating" );
352
+ verifyPodStatus (podName , "Running" );
353
+
358
354
} finally {
359
355
logger .log (
360
356
Level .INFO , "Reverting back the domain to old crd\n kubectl apply -f {0}" , originalYaml );
361
357
TestUtils .exec ("kubectl apply -f " + originalYaml );
362
- logger .info ("Verifying if the admin server is restarted" );
363
- for (int i = 0 ; i < 120000 ; i = i + 10000 ) {
364
- String podStatus =
365
- testUtil .getPodStatus (domain .getDomainNS (), domain1LabelSelector , podName );
366
- Thread .sleep (10000 );
367
- }
358
+ logger .info ("Verifying if the admin server is terminating" );
359
+ verifyPodStatus (podName , "Terminating" );
360
+ verifyPodStatus (podName , "Running" );
368
361
}
369
362
logger .log (Level .INFO , "SUCCESS - {0}" , testMethodName );
370
363
}
@@ -499,4 +492,27 @@ private static void destroyPodsRestartdomain() throws Exception {
499
492
domain .destroy ();
500
493
}
501
494
}
495
+
496
+ private void verifyPodStatus (String podName , String podStatusExpected )
497
+ throws InterruptedException {
498
+ K8sTestUtils testUtil = new K8sTestUtils ();
499
+ String domain1LabelSelector = String .format ("weblogic.domainUID in (%s)" , domainUid );
500
+ String namespace = domain .getDomainNS ();
501
+ boolean gotExpected = false ;
502
+ for (int i = 0 ; i < 12 ; i ++) {
503
+ if (podStatusExpected .equals ("Terminating" )) {
504
+ if (testUtil .isPodTerminating (namespace , domain1LabelSelector , podName )) {
505
+ gotExpected = true ;
506
+ break ;
507
+ }
508
+ } else if (podStatusExpected .equals ("Running" )) {
509
+ if (testUtil .isPodRunning (namespace , domain1LabelSelector , podName )) {
510
+ gotExpected = true ;
511
+ break ;
512
+ }
513
+ }
514
+ Thread .sleep (10000 );
515
+ }
516
+ Assert .assertTrue ("Didn't get the expected pod status" , gotExpected );
517
+ }
502
518
}
0 commit comments