new-integration-tests/src/test/java/oracle/weblogic/kubernetes/ItPodsRestart.java
private static void createAndVerifyMiiDomain() {

    // get the pre-built image created by IntegrationTestWatcher
    String miiImage = MII_BASIC_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG;

    // docker login and push image to docker registry if necessary
    dockerLoginAndPushImageToRegistry(miiImage);

    // create docker registry secret to pull the image from registry
    logger.info("Creating docker registry secret in namespace {0}", domainNamespace);
    createDockerRegistrySecret(domainNamespace);

    // create secret for admin credentials
    logger.info("Creating secret for admin credentials");
    String adminSecretName = "weblogic-credentials";
    createSecretWithUsernamePassword(adminSecretName, domainNamespace, "weblogic", "welcome1");

    // create encryption secret
    logger.info("Creating encryption secret");
    String encryptionSecretName = "encryptionsecret";
    createSecretWithUsernamePassword(encryptionSecretName, domainNamespace, "weblogicenc", "weblogicenc");

    // create the domain CR
    Domain domain = new Domain()
        .apiVersion(DOMAIN_API_VERSION)
        .kind("Domain")
        .metadata(new V1ObjectMeta()
            .name(domainUid)
            .namespace(domainNamespace))
        .spec(new DomainSpec()
            .domainUid(domainUid)
            .domainHomeSourceType("FromModel")
            .image(miiImage)
            .addImagePullSecretsItem(new V1LocalObjectReference()
                .name(REPO_SECRET_NAME))
            .webLogicCredentialsSecret(new V1SecretReference()
                .name(adminSecretName)
                .namespace(domainNamespace))
            .includeServerOutInPodLog(true)
            .serverStartPolicy("IF_NEEDED")
            .serverPod(new ServerPod()
                .addEnvItem(new V1EnvVar()
                    .name("JAVA_OPTIONS")
                    .value("-Dweblogic.StdoutDebugEnabled=false"))
                .addEnvItem(new V1EnvVar()
                    .name("USER_MEM_ARGS")
                    .value("-Djava.security.egd=file:/dev/./urandom "))
                .resources(new V1ResourceRequirements()
                    .limits(new HashMap<>())
                    .requests(new HashMap<>())))
            .adminServer(new AdminServer()
                .serverStartState("RUNNING"))
            .addClustersItem(new Cluster()
                .clusterName(clusterName)
                .replicas(replicaCount)
                .serverStartState("RUNNING"))
            .configuration(new Configuration()
                .model(new Model()
                    .domainType(WLS_DOMAIN_TYPE)
                    .runtimeEncryptionSecret(encryptionSecretName))));

    // create model in image domain
    logger.info("Creating model in image domain {0} in namespace {1} using docker image {2}",
        domainUid, domainNamespace, miiImage);
    createDomainAndVerify(domain, domainNamespace);

    // check that admin server pod exists in the domain namespace
    logger.info("Checking that admin server pod {0} exists in namespace {1}",
        adminServerPodName, domainNamespace);
    checkPodExists(adminServerPodName, domainUid, domainNamespace);

    // check that admin server pod is ready
    logger.info("Checking that admin server pod {0} is ready in namespace {1}",
        adminServerPodName, domainNamespace);
    checkPodReady(adminServerPodName, domainUid, domainNamespace);

    // check that admin service exists in the domain namespace
    logger.info("Checking that admin service {0} exists in namespace {1}",
        adminServerPodName, domainNamespace);
    checkServiceExists(adminServerPodName, domainNamespace);

    // check for managed server pods existence in the domain namespace
    for (int i = 1; i <= replicaCount; i++) {
      String managedServerPodName = managedServerPrefix + i;

      // check that the managed server pod exists in the domain namespace
      logger.info("Checking that managed server pod {0} exists in namespace {1}",
          managedServerPodName, domainNamespace);
      checkPodExists(managedServerPodName, domainUid, domainNamespace);

      // check that the managed server pod is ready
      logger.info("Checking that managed server pod {0} is ready in namespace {1}",
          managedServerPodName, domainNamespace);
      checkPodReady(managedServerPodName, domainUid, domainNamespace);

      // check that the managed server service exists in the domain namespace
      logger.info("Checking that managed server service {0} exists in namespace {1}",
          managedServerPodName, domainNamespace);
      checkServiceExists(managedServerPodName, domainNamespace);
    }
  }
/**
   * Create a model in image domain and verify the server pods are ready.
   */
Create a model in image domain and verify the server pods are ready.
Create a model in image domain and verify the server pods are ready .
private static void createAndVerifyMiiDomain() {
    String miiImage = MII_BASIC_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG;
    dockerLoginAndPushImageToRegistry(miiImage);
    logger.info("Creating docker registry secret in namespace {0}", domainNamespace);
    createDockerRegistrySecret(domainNamespace);
    logger.info("Creating secret for admin credentials");
    String adminSecretName = "weblogic-credentials";
    createSecretWithUsernamePassword(adminSecretName, domainNamespace, "weblogic", "welcome1");
    logger.info("Creating encryption secret");
    String encryptionSecretName = "encryptionsecret";
    createSecretWithUsernamePassword(encryptionSecretName, domainNamespace, "weblogicenc", "weblogicenc");
    Domain domain = new Domain()
        .apiVersion(DOMAIN_API_VERSION)
        .kind("Domain")
        .metadata(new V1ObjectMeta()
            .name(domainUid)
            .namespace(domainNamespace))
        .spec(new DomainSpec()
            .domainUid(domainUid)
            .domainHomeSourceType("FromModel")
            .image(miiImage)
            .addImagePullSecretsItem(new V1LocalObjectReference()
                .name(REPO_SECRET_NAME))
            .webLogicCredentialsSecret(new V1SecretReference()
                .name(adminSecretName)
                .namespace(domainNamespace))
            .includeServerOutInPodLog(true)
            .serverStartPolicy("IF_NEEDED")
            .serverPod(new ServerPod()
                .addEnvItem(new V1EnvVar()
                    .name("JAVA_OPTIONS")
                    .value("-Dweblogic.StdoutDebugEnabled=false"))
                .addEnvItem(new V1EnvVar()
                    .name("USER_MEM_ARGS")
                    .value("-Djava.security.egd=file:/dev/./urandom "))
                .resources(new V1ResourceRequirements()
                    .limits(new HashMap<>())
                    .requests(new HashMap<>())))
            .adminServer(new AdminServer()
                .serverStartState("RUNNING"))
            .addClustersItem(new Cluster()
                .clusterName(clusterName)
                .replicas(replicaCount)
                .serverStartState("RUNNING"))
            .configuration(new Configuration()
                .model(new Model()
                    .domainType(WLS_DOMAIN_TYPE)
                    .runtimeEncryptionSecret(encryptionSecretName))));
    logger.info("Creating model in image domain {0} in namespace {1} using docker image {2}",
        domainUid, domainNamespace, miiImage);
    createDomainAndVerify(domain, domainNamespace);
    logger.info("Checking that admin server pod {0} exists in namespace {1}",
        adminServerPodName, domainNamespace);
    checkPodExists(adminServerPodName, domainUid, domainNamespace);
    logger.info("Checking that admin server pod {0} is ready in namespace {1}",
        adminServerPodName, domainNamespace);
    checkPodReady(adminServerPodName, domainUid, domainNamespace);
    logger.info("Checking that admin service {0} exists in namespace {1}",
        adminServerPodName, domainNamespace);
    checkServiceExists(adminServerPodName, domainNamespace);
    for (int i = 1; i <= replicaCount; i++) {
      String managedServerPodName = managedServerPrefix + i;
      logger.info("Checking that managed server pod {0} exists in namespace {1}",
          managedServerPodName, domainNamespace);
      checkPodExists(managedServerPodName, domainUid, domainNamespace);
      logger.info("Checking that managed server pod {0} is ready in namespace {1}",
          managedServerPodName, domainNamespace);
      checkPodReady(managedServerPodName, domainUid, domainNamespace);
      logger.info("Checking that managed server service {0} exists in namespace {1}",
          managedServerPodName, domainNamespace);
      checkServiceExists(managedServerPodName, domainNamespace);
    }
  }
private static void createAndVerifyMiiDomain ( ) { String miiImage = MII_BASIC_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG ; dockerLoginAndPushImageToRegistry ( miiImage ) ; logger . info ( "Creating docker registry secret in namespace {0}" , domainNamespace ) ; createDockerRegistrySecret ( domainNamespace ) ; logger . info ( "Creating secret for admin credentials" ) ; String adminSecretName = "weblogic-credentials" ; createSecretWithUsernamePassword ( adminSecretName , domainNamespace , "weblogic" , "welcome1" ) ; logger . info ( "Creating encryption secret" ) ; String encryptionSecretName = "encryptionsecret" ; createSecretWithUsernamePassword ( encryptionSecretName , domainNamespace , "weblogicenc" , "weblogicenc" ) ; Domain domain = new Domain ( ) . apiVersion ( DOMAIN_API_VERSION ) . kind ( "Domain" ) . metadata ( new V1ObjectMeta ( ) . name ( domainUid ) . namespace ( domainNamespace ) ) . spec ( new DomainSpec ( ) . domainUid ( domainUid ) . domainHomeSourceType ( "FromModel" ) . image ( miiImage ) . addImagePullSecretsItem ( new V1LocalObjectReference ( ) . name ( REPO_SECRET_NAME ) ) . webLogicCredentialsSecret ( new V1SecretReference ( ) . name ( adminSecretName ) . namespace ( domainNamespace ) ) . includeServerOutInPodLog ( true ) . serverStartPolicy ( "IF_NEEDED" ) . serverPod ( new ServerPod ( ) . addEnvItem ( new V1EnvVar ( ) . name ( "JAVA_OPTIONS" ) . value ( "-Dweblogic.StdoutDebugEnabled=false" ) ) . addEnvItem ( new V1EnvVar ( ) . name ( "USER_MEM_ARGS" ) . value ( "-Djava.security.egd=file:/dev/./urandom " ) ) . resources ( new V1ResourceRequirements ( ) . limits ( new HashMap < > ( ) ) . requests ( new HashMap < > ( ) ) ) ) . adminServer ( new AdminServer ( ) . serverStartState ( "RUNNING" ) ) . addClustersItem ( new Cluster ( ) . clusterName ( clusterName ) . replicas ( replicaCount ) . serverStartState ( "RUNNING" ) ) . configuration ( new Configuration ( ) . model ( new Model ( ) . domainType ( WLS_DOMAIN_TYPE ) . runtimeEncryptionSecret ( encryptionSecretName ) ) ) ) ; logger . info ( "Creating model in image domain {0} in namespace {1} using docker image {2}" , domainUid , domainNamespace , miiImage ) ; createDomainAndVerify ( domain , domainNamespace ) ; logger . info ( "Checking that admin server pod {0} exists in namespace {1}" , adminServerPodName , domainNamespace ) ; checkPodExists ( adminServerPodName , domainUid , domainNamespace ) ; logger . info ( "Checking that admin server pod {0} is ready in namespace {1}" , adminServerPodName , domainNamespace ) ; checkPodReady ( adminServerPodName , domainUid , domainNamespace ) ; logger . info ( "Checking that admin service {0} exists in namespace {1}" , adminServerPodName , domainNamespace ) ; checkServiceExists ( adminServerPodName , domainNamespace ) ; for ( int i = 1 ; i <= replicaCount ; i ++ ) { String managedServerPodName = managedServerPrefix + i ; logger . info ( "Checking that managed server pod {0} exists in namespace {1}" , managedServerPodName , domainNamespace ) ; checkPodExists ( managedServerPodName , domainUid , domainNamespace ) ; logger . info ( "Checking that managed server pod {0} is ready in namespace {1}" , managedServerPodName , domainNamespace ) ; checkPodReady ( managedServerPodName , domainUid , domainNamespace ) ; logger . info ( "Checking that managed server service {0} exists in namespace {1}" , managedServerPodName , domainNamespace ) ; checkServiceExists ( managedServerPodName , domainNamespace ) ; } }
Create a model in image domain and verify the server pods are ready.
Create a model in image domain and verify the server pods are ready .
// get the pre-built image created by IntegrationTestWatcher // docker login and push image to docker registry if necessary // create docker registry secret to pull the image from registry // create secret for admin credentials // create encryption secret // create the domain CR // create model in image domain // check that admin server pod exists in the domain namespace // check that admin server pod is ready // check that admin service exists in the domain namespace // check for managed server pods existence in the domain namespace // check that the managed server pod exists in the domain namespace // check that the managed server pod is ready // check that the managed server service exists in the domain namespace