@@ -481,13 +481,6 @@ private void updateCRDYamlVerifyShutdown(DomainCRD crd, long delayTime) throws E
481
481
Files .write (path , modYaml .getBytes (charset ));
482
482
modifiedYaml = path .toString ();
483
483
// Apply the new yaml to update the domain crd
484
- /*
485
- logger.log(Level.INFO, "kubectl delete -f {0}", originalYaml);
486
- ExecResult exec = TestUtils.exec("kubectl delete -f " + originalYaml);
487
- logger.info(exec.stdout());
488
- TestUtils.checkPodDeleted(domainUid + "-managed-server1", domainNS);
489
- TestUtils.checkPodDeleted(domainUid + "-admin-server", domainNS);
490
- */
491
484
this .domain .shutdown ();
492
485
logger .log (Level .INFO , "kubectl apply -f {0}" , path .toString ());
493
486
ExecResult exec = TestUtils .exec ("kubectl apply -f " + path .toString ());
@@ -496,8 +489,6 @@ private void updateCRDYamlVerifyShutdown(DomainCRD crd, long delayTime) throws E
496
489
logger .info ("Verifying if the domain is restarted" );
497
490
TestUtils .checkPodReady (domainUid + "-admin-server" , domainNS );
498
491
TestUtils .checkPodReady (domainUid + "-managed-server1" , domainNS );
499
- // this.domain.verifyAdminServerRestarted();
500
- // this.domain.verifyManagedServersRestarted();
501
492
502
493
// invoke servlet to keep sessions opened, terminate pod and check shutdown time
503
494
if (delayTime > 0 ) {
@@ -509,15 +500,13 @@ private void updateCRDYamlVerifyShutdown(DomainCRD crd, long delayTime) throws E
509
500
Thread .sleep (5 * 1000 );
510
501
}
511
502
terminationTime = shutdownServer ("managed-server1" );
512
-
513
- // logger.info("Checking termination time");
514
- // terminationTime = checkShutdownTime(domainUid + "-managed-server1");
515
503
logger .info (" termination time: " + terminationTime );
504
+ TestUtils .checkPodCreated (domainUid + "-admin-server" , domainNS );
505
+ TestUtils .checkPodCreated (domainUid + "-managed-server1" , domainNS );
516
506
}
517
507
518
508
private static void getDefaultShutdownTime () throws Exception {
519
509
terminationDefaultOptionsTime = shutdownServer ("managed-server1" );
520
- // terminationDefaultOptionsTime = checkShutdownTime(domainUid + "-managed-server1");
521
510
logger .info (
522
511
" termination pod's time with default shutdown options is: "
523
512
+ terminationDefaultOptionsTime );
@@ -620,10 +609,6 @@ private static long shutdownServer(String serverName) throws Exception {
620
609
long endTime = System .currentTimeMillis ();
621
610
terminationTime = endTime - startTime ;
622
611
return terminationTime ;
623
- // String output = result.stdout().trim();
624
- // logger.info("output from shutting down server:\n" + output);
625
- // TestUtils.checkPodTerminating(domainUid + "-" + serverName, domainNS);
626
- // logger.info(" Pod " + domainUid + "-" + serverName + " is Terminating status :\n" + output);
627
612
}
628
613
629
614
private static boolean checkShutdownUpdatedProp (String podName , String ... props )
@@ -649,53 +634,10 @@ private static boolean checkShutdownUpdatedProp(String podName, String... props)
649
634
propFound .put (prop , new Boolean (true ));
650
635
}
651
636
}
652
- if (props .length == propFound .size ()) found = true ;
653
- return found ;
654
- }
655
-
656
- private static long checkShutdownTime (String podName ) throws Exception {
657
- long startTime = System .currentTimeMillis ();
658
- long endTime = 0 ;
659
- int maxIterations = 50 ;
660
- int waitPodTime = 5 ;
661
- String matchStr = "Terminating" ;
662
- StringBuffer cmd = new StringBuffer ();
663
- cmd .append ("kubectl get pod " ).append (podName ).append (" -n " ).append (domainNS );
664
- int i = 0 ;
665
- while (i < maxIterations ) {
666
- ExecResult result = ExecCommand .exec (cmd .toString ());
667
-
668
- // pod might not have been created or if created loop till condition
669
- if ((result .exitValue () == 0 && result .stdout ().contains (matchStr ))) {
670
- logger .info ("Output for " + cmd + "\n " + result .stdout () + "\n " + result .stderr ());
671
-
672
- // check for last iteration
673
- if (i == (maxIterations - 1 )) {
674
- throw new RuntimeException (
675
- "FAILURE: pod " + podName + " is still in " + matchStr + " status, exiting!" );
676
- }
677
- logger .info (
678
- "Pod "
679
- + podName
680
- + " is "
681
- + matchStr
682
- + " Ite ["
683
- + i
684
- + "/"
685
- + maxIterations
686
- + "], sleeping "
687
- + waitPodTime
688
- + " seconds more" );
689
-
690
- Thread .sleep (maxIterations * 1000 );
691
- i ++;
692
- } else {
693
- endTime = System .currentTimeMillis ();
694
- logger .info ("Pod " + podName + " is not in the " + matchStr + " status or does not exists" );
695
- break ;
696
- }
637
+ if (props .length == propFound .size ()) {
638
+ found = true ;
697
639
}
698
- return ( endTime - startTime ) ;
640
+ return found ;
699
641
}
700
642
}
701
643
0 commit comments