7171import static oracle .weblogic .kubernetes .actions .TestActions .startDomain ;
7272import static oracle .weblogic .kubernetes .actions .impl .primitive .Kubernetes .copyFileToPod ;
7373import static oracle .weblogic .kubernetes .assertions .TestAssertions .adminNodePortAccessible ;
74+ import static oracle .weblogic .kubernetes .assertions .TestAssertions .isNginxReady ;
7475import static oracle .weblogic .kubernetes .assertions .impl .Domain .doesDomainExist ;
7576import static oracle .weblogic .kubernetes .utils .ApplicationUtils .callWebAppAndCheckForServerNameInResponse ;
7677import static oracle .weblogic .kubernetes .utils .ApplicationUtils .callWebAppAndWaitTillReady ;
78+ import static oracle .weblogic .kubernetes .utils .CommonLBTestUtils .checkIngressReady ;
7779import static oracle .weblogic .kubernetes .utils .CommonTestUtils .checkPodReadyAndServiceExists ;
7880import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getNextFreePort ;
7981import static oracle .weblogic .kubernetes .utils .CommonTestUtils .scaleAndVerifyCluster ;
@@ -151,6 +153,7 @@ class ItMultiDomainModelsWithLoadBalancer {
151153 private static String opServiceAccount = null ;
152154 private static NginxParams nginxHelmParams = null ;
153155 private static int nodeportshttp = 0 ;
156+ private static int nodeportshttps = 0 ;
154157 private static int externalRestHttpsPort = 0 ;
155158 private static List <Domain > domains = new ArrayList <>();
156159 private static LoggingFacade logger = null ;
@@ -160,6 +163,7 @@ class ItMultiDomainModelsWithLoadBalancer {
160163 private static String miiDomainNegativeNamespace = null ;
161164 private static String miiImage = null ;
162165 private static String encryptionSecretName = "encryptionsecret" ;
166+ private static String nginxNamespace = null ;
163167 private String curlCmd = null ;
164168
165169 /**
@@ -182,7 +186,7 @@ public static void initAll(@Namespaces(6) List<String> namespaces) {
182186 // get a unique NGINX namespace
183187 logger .info ("Get a unique namespace for NGINX" );
184188 assertNotNull (namespaces .get (1 ), "Namespace list is null" );
185- String nginxNamespace = namespaces .get (1 );
189+ nginxNamespace = namespaces .get (1 );
186190
187191 // get unique namespaces for three different type of domains
188192 logger .info ("Getting unique namespaces for three different type of domains" );
@@ -222,6 +226,8 @@ public static void initAll(@Namespaces(6) List<String> namespaces) {
222226 logger .info ("NGINX service name: {0}" , nginxServiceName );
223227 nodeportshttp = getServiceNodePort (nginxNamespace , nginxServiceName , "http" );
224228 logger .info ("NGINX http node port: {0}" , nodeportshttp );
229+ nodeportshttps = getServiceNodePort (nginxNamespace , nginxServiceName , "https" );
230+ logger .info ("NGINX https node port: {0}" , nodeportshttps );
225231 }
226232 }
227233
@@ -488,11 +494,22 @@ void testLivenessProbe() {
488494 domainNamespace );
489495 }
490496
497+ // check the NGINX pod is ready.
498+ testUntil (isNginxReady (nginxNamespace ),
499+ logger ,
500+ "Nginx is ready in namespace {0}" ,
501+ nginxNamespace );
502+
503+ // check the ingress is ready
504+ String ingressHost = domainUid + "." + domainNamespace + "." + clusterName + ".test" ;
505+ logger .info ("Checking for the ingress is ready" );
506+ checkIngressReady (true , ingressHost , false , nodeportshttp , nodeportshttps , "" );
507+
491508 //access application in managed servers through NGINX load balancer
492509 logger .info ("Accessing the sample app through NGINX load balancer" );
493510 String curlCmd = generateCurlCmd (domainUid , domainNamespace , clusterName , SAMPLE_APP_CONTEXT_ROOT );
494511 List <String > managedServers = listManagedServersBeforeScale (numClusters , clusterName , replicaCount );
495- testUntil (() -> callWebAppAndCheckForServerNameInResponse (curlCmd , managedServers , 20 ),
512+ testUntil (withLongRetryPolicy , () -> callWebAppAndCheckForServerNameInResponse (curlCmd , managedServers , 20 ),
496513 logger ,
497514 "NGINX can access the test web app from all managed servers {0} in the domain" ,
498515 managedServers );
@@ -684,16 +701,19 @@ void testMiiMultiClustersRollingRestart() {
684701 testUntil (
685702 checkDomainEvent (opNamespace , miiDomainNamespace , miiDomainUid , DOMAIN_CHANGED , "Normal" , timestamp ),
686703 logger ,
687- "domain event {0} to be logged" ,
688- DOMAIN_CHANGED );
704+ "domain event {0} to be logged in namespace {1}" ,
705+ DOMAIN_CHANGED ,
706+ miiDomainNamespace );
689707
690708 // wait for longer time for DomainCompleted event
691709 testUntil (
692710 withLongRetryPolicy ,
693711 checkDomainEvent (opNamespace , miiDomainNamespace , miiDomainUid , DOMAIN_PROCESSING_COMPLETED ,
694712 "Normal" , timestamp ),
695713 logger ,
696- DOMAIN_PROCESSING_COMPLETED );
714+ "domain event {0} to be logged in namespace {1}" ,
715+ DOMAIN_PROCESSING_COMPLETED ,
716+ miiDomainNamespace );
697717
698718 // Verify that pod termination and started events are logged only once for each managed server in each cluster
699719 for (int i = 1 ; i <= NUMBER_OF_CLUSTERS_MIIDOMAIN ; i ++) {
@@ -703,20 +723,25 @@ void testMiiMultiClustersRollingRestart() {
703723
704724 logger .info ("Checking that managed server pod {0} is terminated and restarted once in namespace {1}" ,
705725 managedServerPodName , miiDomainNamespace );
726+ String stopEventMsg = "Stopping container weblogic-server" ;
706727 testUntil (
707728 withLongRetryPolicy ,
708- checkPodEventLoggedOnce (miiDomainNamespace , managedServerPodName , POD_TERMINATED , timestamp ),
729+ checkPodEventLoggedOnce (miiDomainNamespace , managedServerPodName , POD_TERMINATED , stopEventMsg , timestamp ),
709730 logger ,
710- "event {0} to be logged for pod {1}" ,
731+ "event {0} to be logged for pod {1} in namespace {2} " ,
711732 POD_TERMINATED ,
712- managedServerPodName );
733+ managedServerPodName ,
734+ miiDomainNamespace );
735+
736+ String startedEventMsg = "Started container weblogic-server" ;
713737 testUntil (
714738 withLongRetryPolicy ,
715- checkPodEventLoggedOnce (miiDomainNamespace , managedServerPodName , POD_STARTED , timestamp ),
739+ checkPodEventLoggedOnce (miiDomainNamespace , managedServerPodName , POD_STARTED , startedEventMsg , timestamp ),
716740 logger ,
717- "event {0} to be logged for pod {1}" ,
741+ "event {0} to be logged for pod {1} in namespace {2} " ,
718742 POD_STARTED ,
719- managedServerPodName );
743+ managedServerPodName ,
744+ miiDomainNamespace );
720745 }
721746 }
722747
0 commit comments