integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java
public void createDomainOnExistingDirectory() throws Exception {

    if (!(BaseTest.OPENSHIFT)) {
      // use krun.sh so that the dir check can work on shared cluster/remote k8s cluster env as well
      String cmd =
          BaseTest.getProjectRoot()
              + "/src/integration-tests/bash/krun.sh -t 180 -m "
              + domainMap.get("persistentVolumeClaimName")
              + ":/pvc-"
              + domainMap.get("domainUID")
              + " -p " + domainMap.get("domainUID") + " -n " + domainNS + " -c \"ls -ltr /pvc-"
              + domainMap.get("domainUID")
              + "/domains/"
              + domainMap.get("domainUID")
              + "\"";
      LoggerHelper.getLocal().log(Level.INFO,
          "making sure the domain directory exists by running " + cmd);
      // Looking for servers directory as sometimes krun.sh exits with non-zero
      // even though the domain directory exists
      ExecResult result = ExecCommand.exec(cmd);
      if (!result.stdout().contains("servers")) {
        throw new RuntimeException("Domain directory doesn't exist");
      }
      LoggerHelper.getLocal().log(Level.INFO, "Run the script to create domain");
    } else {
      String domainStoragePath = domainMap.get("weblogicDomainStoragePath").toString();
      String domainDir = domainStoragePath + "/domains/" + domainMap.get("domainUID").toString();
      LoggerHelper.getLocal().log(Level.INFO, "making sure the domain directory exists");
      if (domainDir != null && !(new File(domainDir).exists())) {
        throw new RuntimeException(
            "FAIL: the domain directory " + domainDir + " does not exist, exiting!");
      }
    }
    LoggerHelper.getLocal().log(Level.INFO, "Run the script to create domain");
    // create domain using different output dir but pv is same, it fails as the domain was already
    // created on the pv dir
    try {
      callCreateDomainScript(userProjectsDir + "2");
    } catch (RuntimeException re) {
      re.printStackTrace();
      LoggerHelper.getLocal().log(
          Level.INFO, "[SUCCESS] create domain job failed, this is the expected behavior");
      return;
    }
    throw new RuntimeException("FAIL: unexpected result, create domain job did not report error");
  }
/**
   * Create domain on existing directory.
   *
   * @throws Exception if domain job does not fail when domain home dir exists
   */
Create domain on existing directory.
@throws Exception if domain job does not fail when domain home dir exists
Create domain on existing directory . @throws Exception if domain job does not fail when domain home dir exists
public void createDomainOnExistingDirectory() throws Exception {
    if (!(BaseTest.OPENSHIFT)) {
      String cmd =
          BaseTest.getProjectRoot()
              + "/src/integration-tests/bash/krun.sh -t 180 -m "
              + domainMap.get("persistentVolumeClaimName")
              + ":/pvc-"
              + domainMap.get("domainUID")
              + " -p " + domainMap.get("domainUID") + " -n " + domainNS + " -c \"ls -ltr /pvc-"
              + domainMap.get("domainUID")
              + "/domains/"
              + domainMap.get("domainUID")
              + "\"";
      LoggerHelper.getLocal().log(Level.INFO,
          "making sure the domain directory exists by running " + cmd);
      ExecResult result = ExecCommand.exec(cmd);
      if (!result.stdout().contains("servers")) {
        throw new RuntimeException("Domain directory doesn't exist");
      }
      LoggerHelper.getLocal().log(Level.INFO, "Run the script to create domain");
    } else {
      String domainStoragePath = domainMap.get("weblogicDomainStoragePath").toString();
      String domainDir = domainStoragePath + "/domains/" + domainMap.get("domainUID").toString();
      LoggerHelper.getLocal().log(Level.INFO, "making sure the domain directory exists");
      if (domainDir != null && !(new File(domainDir).exists())) {
        throw new RuntimeException(
            "FAIL: the domain directory " + domainDir + " does not exist, exiting!");
      }
    }
    LoggerHelper.getLocal().log(Level.INFO, "Run the script to create domain");
    try {
      callCreateDomainScript(userProjectsDir + "2");
    } catch (RuntimeException re) {
      re.printStackTrace();
      LoggerHelper.getLocal().log(
          Level.INFO, "[SUCCESS] create domain job failed, this is the expected behavior");
      return;
    }
    throw new RuntimeException("FAIL: unexpected result, create domain job did not report error");
  }
public void createDomainOnExistingDirectory ( ) throws Exception { if ( ! ( BaseTest . OPENSHIFT ) ) { String cmd = BaseTest . getProjectRoot ( ) + "/src/integration-tests/bash/krun.sh -t 180 -m " + domainMap . get ( "persistentVolumeClaimName" ) + ":/pvc-" + domainMap . get ( "domainUID" ) + " -p " + domainMap . get ( "domainUID" ) + " -n " + domainNS + " -c \"ls -ltr /pvc-" + domainMap . get ( "domainUID" ) + "/domains/" + domainMap . get ( "domainUID" ) + "\"" ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "making sure the domain directory exists by running " + cmd ) ; ExecResult result = ExecCommand . exec ( cmd ) ; if ( ! result . stdout ( ) . contains ( "servers" ) ) { throw new RuntimeException ( "Domain directory doesn't exist" ) ; } LoggerHelper . getLocal ( ) . log ( Level . INFO , "Run the script to create domain" ) ; } else { String domainStoragePath = domainMap . get ( "weblogicDomainStoragePath" ) . toString ( ) ; String domainDir = domainStoragePath + "/domains/" + domainMap . get ( "domainUID" ) . toString ( ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "making sure the domain directory exists" ) ; if ( domainDir != null && ! ( new File ( domainDir ) . exists ( ) ) ) { throw new RuntimeException ( "FAIL: the domain directory " + domainDir + " does not exist, exiting!" ) ; } } LoggerHelper . getLocal ( ) . log ( Level . INFO , "Run the script to create domain" ) ; try { callCreateDomainScript ( userProjectsDir + "2" ) ; } catch ( RuntimeException re ) { re . printStackTrace ( ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "[SUCCESS] create domain job failed, this is the expected behavior" ) ; return ; } throw new RuntimeException ( "FAIL: unexpected result, create domain job did not report error" ) ; }
Create domain on existing directory.
Create domain on existing directory .
// use krun.sh so that the dir check can work on shared cluster/remote k8s cluster env as well // Looking for servers directory as sometimes krun.sh exits with non-zero // even though the domain directory exists // create domain using different output dir but pv is same, it fails as the domain was already // created on the pv dir