integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java
public void deletePvcAndCheckPvReleased(String jobName) throws Exception {
    StringBuffer cmd = new StringBuffer("kubectl get pv ");
    String pvBaseName = (String) pvMap.get("baseName");
    if (domainUid != null) {
      pvBaseName = domainUid + "-" + pvBaseName;
    }
    cmd.append(pvBaseName).append("-pv -n ").append(domainNS);

    ExecResult result = ExecCommand.exec(cmd.toString());
    if (result.exitValue() == 0) {
      LoggerHelper.getLocal().log(Level.INFO,
          "Status of PV before deleting PVC " + result.stdout());
    }
    TestUtils.deletePvc(pvBaseName + "-pvc", domainNS, domainUid, jobName);
    String reclaimPolicy = (String) domainMap.get("weblogicDomainStorageReclaimPolicy");
    boolean pvReleased = TestUtils.checkPvReleased(pvBaseName, domainNS);
    if (reclaimPolicy != null && reclaimPolicy.equals("Recycle") && !pvReleased) {
      throw new RuntimeException(
          "ERROR: pv for " + domainUid + " still exists after the pvc is deleted, exiting!");
    } else {
      LoggerHelper.getLocal().log(Level.INFO, "PV is released when PVC is deleted");
    }
  }
/**
   * Delete PVC and check PV status.
   * @param jobName job name
   * @throws Exception on failure
   */
Delete PVC and check PV status.
@param jobName job name
@throws Exception on failure
Delete PVC and check PV status . @param jobName job name @throws Exception on failure
public void deletePvcAndCheckPvReleased(String jobName) throws Exception {
    StringBuffer cmd = new StringBuffer("kubectl get pv ");
    String pvBaseName = (String) pvMap.get("baseName");
    if (domainUid != null) {
      pvBaseName = domainUid + "-" + pvBaseName;
    }
    cmd.append(pvBaseName).append("-pv -n ").append(domainNS);
    ExecResult result = ExecCommand.exec(cmd.toString());
    if (result.exitValue() == 0) {
      LoggerHelper.getLocal().log(Level.INFO,
          "Status of PV before deleting PVC " + result.stdout());
    }
    TestUtils.deletePvc(pvBaseName + "-pvc", domainNS, domainUid, jobName);
    String reclaimPolicy = (String) domainMap.get("weblogicDomainStorageReclaimPolicy");
    boolean pvReleased = TestUtils.checkPvReleased(pvBaseName, domainNS);
    if (reclaimPolicy != null && reclaimPolicy.equals("Recycle") && !pvReleased) {
      throw new RuntimeException(
          "ERROR: pv for " + domainUid + " still exists after the pvc is deleted, exiting!");
    } else {
      LoggerHelper.getLocal().log(Level.INFO, "PV is released when PVC is deleted");
    }
  }
public void deletePvcAndCheckPvReleased ( String jobName ) throws Exception { StringBuffer cmd = new StringBuffer ( "kubectl get pv " ) ; String pvBaseName = ( String ) pvMap . get ( "baseName" ) ; if ( domainUid != null ) { pvBaseName = domainUid + "-" + pvBaseName ; } cmd . append ( pvBaseName ) . append ( "-pv -n " ) . append ( domainNS ) ; ExecResult result = ExecCommand . exec ( cmd . toString ( ) ) ; if ( result . exitValue ( ) == 0 ) { LoggerHelper . getLocal ( ) . log ( Level . INFO , "Status of PV before deleting PVC " + result . stdout ( ) ) ; } TestUtils . deletePvc ( pvBaseName + "-pvc" , domainNS , domainUid , jobName ) ; String reclaimPolicy = ( String ) domainMap . get ( "weblogicDomainStorageReclaimPolicy" ) ; boolean pvReleased = TestUtils . checkPvReleased ( pvBaseName , domainNS ) ; if ( reclaimPolicy != null && reclaimPolicy . equals ( "Recycle" ) && ! pvReleased ) { throw new RuntimeException ( "ERROR: pv for " + domainUid + " still exists after the pvc is deleted, exiting!" ) ; } else { LoggerHelper . getLocal ( ) . log ( Level . INFO , "PV is released when PVC is deleted" ) ; } }
Delete PVC and check PV status.
Delete PVC and check PV status .