integration-tests/src/test/java/oracle/kubernetes/operator/ItServerDiscovery.java
@Test
  public void testOpReconnToDomain() throws Exception {
    Assumptions.assumeTrue(FULLTEST);
    String testMethodName = new Object() {
    }.getClass().getEnclosingMethod().getName();
    logTestBegin(testMethodName);

    Map<String, Object> domainMap = domain.getDomainMap();
    String domainNS = domainMap.get("namespace").toString();
    String domainUid = domain.getDomainUid();
    String adminServerName = (String) domainMap.get("adminServerName");
    String adminServerPodName = domainUid + "-" + adminServerName;
    String managedServerNameBase = domainMap.get("managedServerNameBase").toString();
    final String clusterName = domainMap.get("clusterName").toString();

    LoggerHelper.getLocal().log(Level.INFO, "Stop the Operator");
    operator.stopUsingReplicas();

    // Stop admin server
    String cmd = "kubectl delete po/" + adminServerPodName + " -n " + domainNS;
    LoggerHelper.getLocal().log(Level.INFO, "Stop admin server <" + adminServerPodName + "> using command:\n" + cmd);
    TestUtils.execOrAbortProcess(cmd);

    LoggerHelper.getLocal().log(Level.INFO, "Check if admin pod <" + adminServerPodName + "> is deleted");
    TestUtils.checkPodDeleted(adminServerPodName, domainNS);

    // Stop all managed servers in the cluster
    int replicaCnt = TestUtils.getClusterReplicas(domainUid, clusterName, domainNS);

    for (int i = 1; i <= replicaCnt; i++) {
      String msPodName = domainUid + "-" + managedServerNameBase + i;
      cmd = "kubectl delete po/" + msPodName + " -n " + domainNS;
      LoggerHelper.getLocal().log(Level.INFO, "Stop managed server <" + msPodName + "> using command:\n" + cmd);
      TestUtils.execOrAbortProcess(cmd);

      LoggerHelper.getLocal().log(Level.INFO, "Checking if ms pod <" + msPodName + "> is deleted");
      TestUtils.checkPodDeleted(msPodName, domainNS);
    }

    LoggerHelper.getLocal().log(Level.INFO, "Restart the Operator");
    operator.startUsingReplicas();

    LoggerHelper.getLocal().log(Level.INFO, "Check if admin pod <" + adminServerPodName + "> is running");
    TestUtils.checkPodReady(adminServerPodName, domainNS);

    for (int i = 1; i <= replicaCnt; i++) {
      String msPodName = domainUid + "-" + managedServerNameBase + i;
      LoggerHelper.getLocal().log(Level.INFO, "Checking if ms pod <" + msPodName + "> is running");
      TestUtils.checkPodReady(msPodName, domainNS);
    }

    LoggerHelper.getLocal().log(Level.INFO, "SUCCESS - " + testMethodName);
  }
/**
   * Stop Operator. Kill admin server and all managed servers in domain cluster. Restart Operator.
   * Verify that it restarts admin server and all managed servers in domain cluster.
   *
   * @throws Exception exception
   */
Stop Operator. Kill admin server and all managed servers in domain cluster. Restart Operator.
Verify that it restarts admin server and all managed servers in domain cluster.

@throws Exception exception
Stop Operator . Kill admin server and all managed servers in domain cluster . Restart Operator . Verify that it restarts admin server and all managed servers in domain cluster . @throws Exception exception
@Test
  public void testOpReconnToDomain() throws Exception {
    Assumptions.assumeTrue(FULLTEST);
    String testMethodName = new Object() {
    }.getClass().getEnclosingMethod().getName();
    logTestBegin(testMethodName);
    Map<String, Object> domainMap = domain.getDomainMap();
    String domainNS = domainMap.get("namespace").toString();
    String domainUid = domain.getDomainUid();
    String adminServerName = (String) domainMap.get("adminServerName");
    String adminServerPodName = domainUid + "-" + adminServerName;
    String managedServerNameBase = domainMap.get("managedServerNameBase").toString();
    final String clusterName = domainMap.get("clusterName").toString();
    LoggerHelper.getLocal().log(Level.INFO, "Stop the Operator");
    operator.stopUsingReplicas();
    String cmd = "kubectl delete po/" + adminServerPodName + " -n " + domainNS;
    LoggerHelper.getLocal().log(Level.INFO, "Stop admin server <" + adminServerPodName + "> using command:\n" + cmd);
    TestUtils.execOrAbortProcess(cmd);
    LoggerHelper.getLocal().log(Level.INFO, "Check if admin pod <" + adminServerPodName + "> is deleted");
    TestUtils.checkPodDeleted(adminServerPodName, domainNS);
    int replicaCnt = TestUtils.getClusterReplicas(domainUid, clusterName, domainNS);
    for (int i = 1; i <= replicaCnt; i++) {
      String msPodName = domainUid + "-" + managedServerNameBase + i;
      cmd = "kubectl delete po/" + msPodName + " -n " + domainNS;
      LoggerHelper.getLocal().log(Level.INFO, "Stop managed server <" + msPodName + "> using command:\n" + cmd);
      TestUtils.execOrAbortProcess(cmd);
      LoggerHelper.getLocal().log(Level.INFO, "Checking if ms pod <" + msPodName + "> is deleted");
      TestUtils.checkPodDeleted(msPodName, domainNS);
    }
    LoggerHelper.getLocal().log(Level.INFO, "Restart the Operator");
    operator.startUsingReplicas();
    LoggerHelper.getLocal().log(Level.INFO, "Check if admin pod <" + adminServerPodName + "> is running");
    TestUtils.checkPodReady(adminServerPodName, domainNS);
    for (int i = 1; i <= replicaCnt; i++) {
      String msPodName = domainUid + "-" + managedServerNameBase + i;
      LoggerHelper.getLocal().log(Level.INFO, "Checking if ms pod <" + msPodName + "> is running");
      TestUtils.checkPodReady(msPodName, domainNS);
    }
    LoggerHelper.getLocal().log(Level.INFO, "SUCCESS - " + testMethodName);
  }
@ Test public void testOpReconnToDomain ( ) throws Exception { Assumptions . assumeTrue ( FULLTEST ) ; String testMethodName = new Object ( ) { } . getClass ( ) . getEnclosingMethod ( ) . getName ( ) ; logTestBegin ( testMethodName ) ; Map < String , Object > domainMap = domain . getDomainMap ( ) ; String domainNS = domainMap . get ( "namespace" ) . toString ( ) ; String domainUid = domain . getDomainUid ( ) ; String adminServerName = ( String ) domainMap . get ( "adminServerName" ) ; String adminServerPodName = domainUid + "-" + adminServerName ; String managedServerNameBase = domainMap . get ( "managedServerNameBase" ) . toString ( ) ; final String clusterName = domainMap . get ( "clusterName" ) . toString ( ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Stop the Operator" ) ; operator . stopUsingReplicas ( ) ; String cmd = "kubectl delete po/" + adminServerPodName + " -n " + domainNS ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Stop admin server <" + adminServerPodName + "> using command:\n" + cmd ) ; TestUtils . execOrAbortProcess ( cmd ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Check if admin pod <" + adminServerPodName + "> is deleted" ) ; TestUtils . checkPodDeleted ( adminServerPodName , domainNS ) ; int replicaCnt = TestUtils . getClusterReplicas ( domainUid , clusterName , domainNS ) ; for ( int i = 1 ; i <= replicaCnt ; i ++ ) { String msPodName = domainUid + "-" + managedServerNameBase + i ; cmd = "kubectl delete po/" + msPodName + " -n " + domainNS ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Stop managed server <" + msPodName + "> using command:\n" + cmd ) ; TestUtils . execOrAbortProcess ( cmd ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Checking if ms pod <" + msPodName + "> is deleted" ) ; TestUtils . checkPodDeleted ( msPodName , domainNS ) ; } LoggerHelper . getLocal ( ) . log ( Level . INFO , "Restart the Operator" ) ; operator . startUsingReplicas ( ) ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Check if admin pod <" + adminServerPodName + "> is running" ) ; TestUtils . checkPodReady ( adminServerPodName , domainNS ) ; for ( int i = 1 ; i <= replicaCnt ; i ++ ) { String msPodName = domainUid + "-" + managedServerNameBase + i ; LoggerHelper . getLocal ( ) . log ( Level . INFO , "Checking if ms pod <" + msPodName + "> is running" ) ; TestUtils . checkPodReady ( msPodName , domainNS ) ; } LoggerHelper . getLocal ( ) . log ( Level . INFO , "SUCCESS - " + testMethodName ) ; }
Stop Operator.
Stop Operator .
// Stop admin server // Stop all managed servers in the cluster