new-integration-tests/src/test/java/oracle/weblogic/kubernetes/ItUsabilityOperatorHelmChart.java
@Test
  @DisplayName("Create operator and domain, then delete operator and verify the domain is still running")
  @Slow
  @MustNotRunInParallel
  public void testDeleteOperatorButNotDomain() {
    // install and verify operator
    logger.info("Installing and verifying operator");
    HelmParams opHelmParams = installAndVerifyOperator(opNamespace, domainNamespace);

    // create and verify the domain
    logger.info("Creating and verifying model in image domain");
    createAndVerifyMiiDomain();

    // get the admin server pod original creation timestamp
    logger.info("Getting admin server pod original creation timestamp");
    DateTime adminPodOriginalTimestamp =
        assertDoesNotThrow(() -> getPodCreationTimestamp(domainNamespace, "", adminServerPodName),
            String.format("getPodCreationTimestamp failed with ApiException for pod %s in namespace %s",
                adminServerPodName, domainNamespace));

    // get the managed server pods original creation timestamps
    logger.info("Getting managed server pods original creation timestamps");
    List<DateTime> managedServerPodOriginalTimestampList = new ArrayList<>();
    for (int i = 1; i <= replicaCount; i++) {
      final String managedServerPodName = managedServerPrefix + i;
      managedServerPodOriginalTimestampList.add(
          assertDoesNotThrow(() -> getPodCreationTimestamp(domainNamespace, "", managedServerPodName),
              String.format("getPodCreationTimestamp failed with ApiException for pod %s in namespace %s",
                  managedServerPodName, domainNamespace)));
    }

    // create ingress for the domain
    logger.info("Creating ingress for domain {0} in namespace {1}", domainUid, domainNamespace);
    Map<String, Integer> clusterNameMsPortMap = new HashMap<>();
    clusterNameMsPortMap.put(clusterName, managedServerPort);
    ingressHostList =
        createIngressForDomainAndVerify(domainUid, domainNamespace, clusterNameMsPortMap);

    // verify the sample apps for the domain
    logger.info("Checking that the sample app can be accessed from all managed servers through NGINX");
    verifySampleAppAccessThroughNginx();

    // delete operator
    logger.info("Uninstalling operator");
    uninstallOperator(opHelmParams);

    // verify the operator pod does not exist in the operator namespace
    logger.info("Checking that operator pod does not exist in operator namespace");
    checkPodDoesNotExist("weblogic-operator-", null, opNamespace);

    // verify the operator service does not exist in the operator namespace
    logger.info("Checking that operator service does not exist in operator namespace");
    checkServiceDoesNotExist(OPERATOR_SERVICE_NAME, opNamespace);

    // check that the state of admin server pod in the domain was not changed
    // wait some time here to ensure the pod state is not changed
    try {
      Thread.sleep(15000);
    } catch (InterruptedException e) {
      // ignore
    }

    logger.info("Checking that the admin server pod state was not changed after the operator was deleted");
    assertThat(podStateNotChanged(adminServerPodName, domainUid, domainNamespace, adminPodOriginalTimestamp))
        .as("Test state of pod {0} was not changed in namespace {1}", adminServerPodName, domainNamespace)
        .withFailMessage("State of pod {0} was changed in namespace {1}",
            adminServerPodName, domainNamespace)
        .isTrue();

    // check that the states of managed server pods in the domain were not changed
    logger.info("Checking that the managed server pod state was not changed after the operator was deleted");
    for (int i = 1; i <= replicaCount; i++) {
      String managedServerPodName = managedServerPrefix + i;
      assertThat(podStateNotChanged(managedServerPodName, domainUid, domainNamespace,
              managedServerPodOriginalTimestampList.get(i - 1)))
          .as("Test state of pod {0} was not changed in namespace {1}", managedServerPodName, domainNamespace)
          .withFailMessage("State of pod {0} was changed in namespace {1}",
              managedServerPodName, domainNamespace)
          .isTrue();
    }

    // verify the sample app in the domain is still accessible from all managed servers through NGINX
    logger.info("Checking that the sample app can be accessed from all managed servers through NGINX "
        + "after the operator was deleted");
    verifySampleAppAccessThroughNginx();
  }
/**
   * Create operator and verify it is deployed successfully.
   * Create a custom domain resource and verify all server pods in the domain were created and ready.
   * Verify NGINX can access the sample app from all managed servers in the domain.
   * Delete operator.
   * Verify the states of all server pods in the domain were not changed.
   * Verify NGINX can access the sample app from all managed servers in the domain after the operator was deleted.
   * Test fails if the state of any pod in the domain was changed or NGINX can not access the sample app from
   * all managed servers in the absence of operator.
   */
Create operator and verify it is deployed successfully.
Create a custom domain resource and verify all server pods in the domain were created and ready.
Verify NGINX can access the sample app from all managed servers in the domain.
Delete operator.
Verify the states of all server pods in the domain were not changed.
Verify NGINX can access the sample app from all managed servers in the domain after the operator was deleted.
Test fails if the state of any pod in the domain was changed or NGINX can not access the sample app from
all managed servers in the absence of operator.
Create operator and verify it is deployed successfully . Create a custom domain resource and verify all server pods in the domain were created and ready . Verify NGINX can access the sample app from all managed servers in the domain . Delete operator . Verify the states of all server pods in the domain were not changed . Verify NGINX can access the sample app from all managed servers in the domain after the operator was deleted . Test fails if the state of any pod in the domain was changed or NGINX can not access the sample app from all managed servers in the absence of operator .
@Test
  @DisplayName("Create operator and domain, then delete operator and verify the domain is still running")
  @Slow
  @MustNotRunInParallel
  public void testDeleteOperatorButNotDomain() {
    logger.info("Installing and verifying operator");
    HelmParams opHelmParams = installAndVerifyOperator(opNamespace, domainNamespace);
    logger.info("Creating and verifying model in image domain");
    createAndVerifyMiiDomain();
    logger.info("Getting admin server pod original creation timestamp");
    DateTime adminPodOriginalTimestamp =
        assertDoesNotThrow(() -> getPodCreationTimestamp(domainNamespace, "", adminServerPodName),
            String.format("getPodCreationTimestamp failed with ApiException for pod %s in namespace %s",
                adminServerPodName, domainNamespace));
    logger.info("Getting managed server pods original creation timestamps");
    List<DateTime> managedServerPodOriginalTimestampList = new ArrayList<>();
    for (int i = 1; i <= replicaCount; i++) {
      final String managedServerPodName = managedServerPrefix + i;
      managedServerPodOriginalTimestampList.add(
          assertDoesNotThrow(() -> getPodCreationTimestamp(domainNamespace, "", managedServerPodName),
              String.format("getPodCreationTimestamp failed with ApiException for pod %s in namespace %s",
                  managedServerPodName, domainNamespace)));
    }
    logger.info("Creating ingress for domain {0} in namespace {1}", domainUid, domainNamespace);
    Map<String, Integer> clusterNameMsPortMap = new HashMap<>();
    clusterNameMsPortMap.put(clusterName, managedServerPort);
    ingressHostList =
        createIngressForDomainAndVerify(domainUid, domainNamespace, clusterNameMsPortMap);
    logger.info("Checking that the sample app can be accessed from all managed servers through NGINX");
    verifySampleAppAccessThroughNginx();
    logger.info("Uninstalling operator");
    uninstallOperator(opHelmParams);
    logger.info("Checking that operator pod does not exist in operator namespace");
    checkPodDoesNotExist("weblogic-operator-", null, opNamespace);
    logger.info("Checking that operator service does not exist in operator namespace");
    checkServiceDoesNotExist(OPERATOR_SERVICE_NAME, opNamespace);
    try {
      Thread.sleep(15000);
    } catch (InterruptedException e) {
    }
    logger.info("Checking that the admin server pod state was not changed after the operator was deleted");
    assertThat(podStateNotChanged(adminServerPodName, domainUid, domainNamespace, adminPodOriginalTimestamp))
        .as("Test state of pod {0} was not changed in namespace {1}", adminServerPodName, domainNamespace)
        .withFailMessage("State of pod {0} was changed in namespace {1}",
            adminServerPodName, domainNamespace)
        .isTrue();
    logger.info("Checking that the managed server pod state was not changed after the operator was deleted");
    for (int i = 1; i <= replicaCount; i++) {
      String managedServerPodName = managedServerPrefix + i;
      assertThat(podStateNotChanged(managedServerPodName, domainUid, domainNamespace,
              managedServerPodOriginalTimestampList.get(i - 1)))
          .as("Test state of pod {0} was not changed in namespace {1}", managedServerPodName, domainNamespace)
          .withFailMessage("State of pod {0} was changed in namespace {1}",
              managedServerPodName, domainNamespace)
          .isTrue();
    }
    logger.info("Checking that the sample app can be accessed from all managed servers through NGINX "
        + "after the operator was deleted");
    verifySampleAppAccessThroughNginx();
  }
@ Test @ DisplayName ( "Create operator and domain, then delete operator and verify the domain is still running" ) @ Slow @ MustNotRunInParallel public void testDeleteOperatorButNotDomain ( ) { logger . info ( "Installing and verifying operator" ) ; HelmParams opHelmParams = installAndVerifyOperator ( opNamespace , domainNamespace ) ; logger . info ( "Creating and verifying model in image domain" ) ; createAndVerifyMiiDomain ( ) ; logger . info ( "Getting admin server pod original creation timestamp" ) ; DateTime adminPodOriginalTimestamp = assertDoesNotThrow ( ( ) -> getPodCreationTimestamp ( domainNamespace , "" , adminServerPodName ) , String . format ( "getPodCreationTimestamp failed with ApiException for pod %s in namespace %s" , adminServerPodName , domainNamespace ) ) ; logger . info ( "Getting managed server pods original creation timestamps" ) ; List < DateTime > managedServerPodOriginalTimestampList = new ArrayList < > ( ) ; for ( int i = 1 ; i <= replicaCount ; i ++ ) { final String managedServerPodName = managedServerPrefix + i ; managedServerPodOriginalTimestampList . add ( assertDoesNotThrow ( ( ) -> getPodCreationTimestamp ( domainNamespace , "" , managedServerPodName ) , String . format ( "getPodCreationTimestamp failed with ApiException for pod %s in namespace %s" , managedServerPodName , domainNamespace ) ) ) ; } logger . info ( "Creating ingress for domain {0} in namespace {1}" , domainUid , domainNamespace ) ; Map < String , Integer > clusterNameMsPortMap = new HashMap < > ( ) ; clusterNameMsPortMap . put ( clusterName , managedServerPort ) ; ingressHostList = createIngressForDomainAndVerify ( domainUid , domainNamespace , clusterNameMsPortMap ) ; logger . info ( "Checking that the sample app can be accessed from all managed servers through NGINX" ) ; verifySampleAppAccessThroughNginx ( ) ; logger . info ( "Uninstalling operator" ) ; uninstallOperator ( opHelmParams ) ; logger . info ( "Checking that operator pod does not exist in operator namespace" ) ; checkPodDoesNotExist ( "weblogic-operator-" , null , opNamespace ) ; logger . info ( "Checking that operator service does not exist in operator namespace" ) ; checkServiceDoesNotExist ( OPERATOR_SERVICE_NAME , opNamespace ) ; try { Thread . sleep ( 15000 ) ; } catch ( InterruptedException e ) { } logger . info ( "Checking that the admin server pod state was not changed after the operator was deleted" ) ; assertThat ( podStateNotChanged ( adminServerPodName , domainUid , domainNamespace , adminPodOriginalTimestamp ) ) . as ( "Test state of pod {0} was not changed in namespace {1}" , adminServerPodName , domainNamespace ) . withFailMessage ( "State of pod {0} was changed in namespace {1}" , adminServerPodName , domainNamespace ) . isTrue ( ) ; logger . info ( "Checking that the managed server pod state was not changed after the operator was deleted" ) ; for ( int i = 1 ; i <= replicaCount ; i ++ ) { String managedServerPodName = managedServerPrefix + i ; assertThat ( podStateNotChanged ( managedServerPodName , domainUid , domainNamespace , managedServerPodOriginalTimestampList . get ( i - 1 ) ) ) . as ( "Test state of pod {0} was not changed in namespace {1}" , managedServerPodName , domainNamespace ) . withFailMessage ( "State of pod {0} was changed in namespace {1}" , managedServerPodName , domainNamespace ) . isTrue ( ) ; } logger . info ( "Checking that the sample app can be accessed from all managed servers through NGINX " + "after the operator was deleted" ) ; verifySampleAppAccessThroughNginx ( ) ; }
Create operator and verify it is deployed successfully.
Create operator and verify it is deployed successfully .
// install and verify operator // create and verify the domain // get the admin server pod original creation timestamp // get the managed server pods original creation timestamps // create ingress for the domain // verify the sample apps for the domain // delete operator // verify the operator pod does not exist in the operator namespace // verify the operator service does not exist in the operator namespace // check that the state of admin server pod in the domain was not changed // wait some time here to ensure the pod state is not changed // ignore // check that the states of managed server pods in the domain were not changed // verify the sample app in the domain is still accessible from all managed servers through NGINX