integration-tests/src/test/java/oracle/kubernetes/operator/utils/TestUtils.java
public static boolean checkPvReleased(String pvBaseName, String namespace) throws Exception {
    StringBuffer cmd = new StringBuffer("kubectl get pv ");
    cmd.append(pvBaseName).append("-pv -n ").append(namespace);

    int i = 0;
    while (i < BaseTest.getMaxIterationsPod()) {
      LoggerHelper.getLocal().log(Level.INFO, "Iteration " + i + " Checking if PV is Released " + cmd);
      ExecResult result = ExecCommand.exec(cmd.toString());
      if (result.exitValue() != 0
          || result.exitValue() == 0 && !result.stdout().contains("Released")) {
        if (i == (BaseTest.getMaxIterationsPod() - 1)) {
          throw new RuntimeException("FAILURE: PV is not in Released status, exiting!");
        }
        LoggerHelper.getLocal().log(Level.INFO, "PV is not in Released status,"
            + result.stdout() + "\n " + result.stderr());
        Thread.sleep(BaseTest.getWaitTimePod() * 1000);
        i++;

      } else {
        LoggerHelper.getLocal().log(Level.INFO, "PV is in Released status," + result.stdout());
        break;
      }
    }
    return true;
  }
/**
   * Check PV is released.
   * @param pvBaseName PV base name
   * @param namespace namespace
   * @return true, if released
   * @throws Exception on failure
   */
Check PV is released.
@param pvBaseName PV base name
@param namespace namespace
@return true, if released
@throws Exception on failure
Check PV is released . @param pvBaseName PV base name @param namespace namespace @return true if released @throws Exception on failure
public static boolean checkPvReleased(String pvBaseName, String namespace) throws Exception {
    StringBuffer cmd = new StringBuffer("kubectl get pv ");
    cmd.append(pvBaseName).append("-pv -n ").append(namespace);
    int i = 0;
    while (i < BaseTest.getMaxIterationsPod()) {
      LoggerHelper.getLocal().log(Level.INFO, "Iteration " + i + " Checking if PV is Released " + cmd);
      ExecResult result = ExecCommand.exec(cmd.toString());
      if (result.exitValue() != 0
          || result.exitValue() == 0 && !result.stdout().contains("Released")) {
        if (i == (BaseTest.getMaxIterationsPod() - 1)) {
          throw new RuntimeException("FAILURE: PV is not in Released status, exiting!");
        }
        LoggerHelper.getLocal().log(Level.INFO, "PV is not in Released status,"
            + result.stdout() + "\n " + result.stderr());
        Thread.sleep(BaseTest.getWaitTimePod() * 1000);
        i++;
      } else {
        LoggerHelper.getLocal().log(Level.INFO, "PV is in Released status," + result.stdout());
        break;
      }
    }
    return true;
  }
public static boolean checkPvReleased ( String pvBaseName , String namespace ) throws Exception { StringBuffer cmd = new StringBuffer ( "kubectl get pv " ) ; cmd . append ( pvBaseName ) . append ( "-pv -n " ) . append ( namespace ) ; int i = 0 ; while ( i < BaseTest . getMaxIterationsPod ( ) ) { LoggerHelper . getLocal ( ) . log ( Level . INFO , "Iteration " + i + " Checking if PV is Released " + cmd ) ; ExecResult result = ExecCommand . exec ( cmd . toString ( ) ) ; if ( result . exitValue ( ) != 0 || result . exitValue ( ) == 0 && ! result . stdout ( ) . contains ( "Released" ) ) { if ( i == ( BaseTest . getMaxIterationsPod ( ) - 1 ) ) { throw new RuntimeException ( "FAILURE: PV is not in Released status, exiting!" ) ; } LoggerHelper . getLocal ( ) . log ( Level . INFO , "PV is not in Released status," + result . stdout ( ) + "\n " + result . stderr ( ) ) ; Thread . sleep ( BaseTest . getWaitTimePod ( ) * 1000 ) ; i ++ ; } else { LoggerHelper . getLocal ( ) . log ( Level . INFO , "PV is in Released status," + result . stdout ( ) ) ; break ; } } return true ; }
Check PV is released.
Check PV is released .