integration-tests/src/test/java/oracle/kubernetes/operator/ItOperatorUpgrade.java
@AfterEach
  public void cleanupOperatorAndDomain() throws Exception {
    if (testCompletedSuccessfully) {
      LoggerHelper.getLocal().log(Level.INFO, "+++++++++++++++Beginning AfterTest cleanup+++++++++++++++++++++");
      if (domain != null) {
        TestUtils.deleteWeblogicDomainResources(domain.getDomainUid());
        TestUtils.verifyAfterDeletion(domain);
        domain.deleteImage();
      }
      if (operator != null) {
        operator.destroy();
      }
      TestUtils.execOrAbortProcess("rm -rf " + Paths.get(opUpgradeTmpDir).toString());
      TestUtils.execOrAbortProcess("kubectl delete crd domains.weblogic.oracle --ignore-not-found");
      // Make sure domain CRD is deleted form k8s 
      ExecResult result = ExecCommand.exec("kubectl get crd domains.weblogic.oracle",true);
      Assertions.assertEquals(1, result.exitValue());
      LoggerHelper.getLocal().log(Level.INFO, "+++++++++++++++Done AfterTest cleanup+++++++++++++++++++++");
    }
  }
/**
   * cleanup the domain and operator after every test.
   *
   * @throws Exception when domain and operator cleanup fails
   */
cleanup the domain and operator after every test.
@throws Exception when domain and operator cleanup fails
cleanup the domain and operator after every test . @throws Exception when domain and operator cleanup fails
@AfterEach
  public void cleanupOperatorAndDomain() throws Exception {
    if (testCompletedSuccessfully) {
      LoggerHelper.getLocal().log(Level.INFO, "+++++++++++++++Beginning AfterTest cleanup+++++++++++++++++++++");
      if (domain != null) {
        TestUtils.deleteWeblogicDomainResources(domain.getDomainUid());
        TestUtils.verifyAfterDeletion(domain);
        domain.deleteImage();
      }
      if (operator != null) {
        operator.destroy();
      }
      TestUtils.execOrAbortProcess("rm -rf " + Paths.get(opUpgradeTmpDir).toString());
      TestUtils.execOrAbortProcess("kubectl delete crd domains.weblogic.oracle --ignore-not-found");
      ExecResult result = ExecCommand.exec("kubectl get crd domains.weblogic.oracle",true);
      Assertions.assertEquals(1, result.exitValue());
      LoggerHelper.getLocal().log(Level.INFO, "+++++++++++++++Done AfterTest cleanup+++++++++++++++++++++");
    }
  }
@ AfterEach public void cleanupOperatorAndDomain ( ) throws Exception { if ( testCompletedSuccessfully ) { LoggerHelper . getLocal ( ) . log ( Level . INFO , "+++++++++++++++Beginning AfterTest cleanup+++++++++++++++++++++" ) ; if ( domain != null ) { TestUtils . deleteWeblogicDomainResources ( domain . getDomainUid ( ) ) ; TestUtils . verifyAfterDeletion ( domain ) ; domain . deleteImage ( ) ; } if ( operator != null ) { operator . destroy ( ) ; } TestUtils . execOrAbortProcess ( "rm -rf " + Paths . get ( opUpgradeTmpDir ) . toString ( ) ) ; TestUtils . execOrAbortProcess ( "kubectl delete crd domains.weblogic.oracle --ignore-not-found" ) ; ExecResult result = ExecCommand . exec ( "kubectl get crd domains.weblogic.oracle" , true ) ; Assertions . assertEquals ( 1 , result . exitValue ( ) ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "+++++++++++++++Done AfterTest cleanup+++++++++++++++++++++" ) ; } }
cleanup the domain and operator after every test.
cleanup the domain and operator after every test .
// Make sure domain CRD is deleted form k8s 