71
71
import static oracle .weblogic .kubernetes .actions .TestActions .startDomain ;
72
72
import static oracle .weblogic .kubernetes .actions .impl .primitive .Kubernetes .copyFileToPod ;
73
73
import static oracle .weblogic .kubernetes .assertions .TestAssertions .adminNodePortAccessible ;
74
+ import static oracle .weblogic .kubernetes .assertions .TestAssertions .isNginxReady ;
74
75
import static oracle .weblogic .kubernetes .assertions .impl .Domain .doesDomainExist ;
75
76
import static oracle .weblogic .kubernetes .utils .ApplicationUtils .callWebAppAndCheckForServerNameInResponse ;
76
77
import static oracle .weblogic .kubernetes .utils .ApplicationUtils .callWebAppAndWaitTillReady ;
78
+ import static oracle .weblogic .kubernetes .utils .CommonLBTestUtils .checkIngressReady ;
77
79
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .checkPodReadyAndServiceExists ;
78
80
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getNextFreePort ;
79
81
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .scaleAndVerifyCluster ;
@@ -151,6 +153,7 @@ class ItMultiDomainModelsWithLoadBalancer {
151
153
private static String opServiceAccount = null ;
152
154
private static NginxParams nginxHelmParams = null ;
153
155
private static int nodeportshttp = 0 ;
156
+ private static int nodeportshttps = 0 ;
154
157
private static int externalRestHttpsPort = 0 ;
155
158
private static List <Domain > domains = new ArrayList <>();
156
159
private static LoggingFacade logger = null ;
@@ -160,6 +163,7 @@ class ItMultiDomainModelsWithLoadBalancer {
160
163
private static String miiDomainNegativeNamespace = null ;
161
164
private static String miiImage = null ;
162
165
private static String encryptionSecretName = "encryptionsecret" ;
166
+ private static String nginxNamespace = null ;
163
167
private String curlCmd = null ;
164
168
165
169
/**
@@ -182,7 +186,7 @@ public static void initAll(@Namespaces(6) List<String> namespaces) {
182
186
// get a unique NGINX namespace
183
187
logger .info ("Get a unique namespace for NGINX" );
184
188
assertNotNull (namespaces .get (1 ), "Namespace list is null" );
185
- String nginxNamespace = namespaces .get (1 );
189
+ nginxNamespace = namespaces .get (1 );
186
190
187
191
// get unique namespaces for three different type of domains
188
192
logger .info ("Getting unique namespaces for three different type of domains" );
@@ -222,6 +226,8 @@ public static void initAll(@Namespaces(6) List<String> namespaces) {
222
226
logger .info ("NGINX service name: {0}" , nginxServiceName );
223
227
nodeportshttp = getServiceNodePort (nginxNamespace , nginxServiceName , "http" );
224
228
logger .info ("NGINX http node port: {0}" , nodeportshttp );
229
+ nodeportshttps = getServiceNodePort (nginxNamespace , nginxServiceName , "https" );
230
+ logger .info ("NGINX https node port: {0}" , nodeportshttps );
225
231
}
226
232
}
227
233
@@ -488,11 +494,22 @@ void testLivenessProbe() {
488
494
domainNamespace );
489
495
}
490
496
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
+
491
508
//access application in managed servers through NGINX load balancer
492
509
logger .info ("Accessing the sample app through NGINX load balancer" );
493
510
String curlCmd = generateCurlCmd (domainUid , domainNamespace , clusterName , SAMPLE_APP_CONTEXT_ROOT );
494
511
List <String > managedServers = listManagedServersBeforeScale (numClusters , clusterName , replicaCount );
495
- testUntil (() -> callWebAppAndCheckForServerNameInResponse (curlCmd , managedServers , 20 ),
512
+ testUntil (withLongRetryPolicy , () -> callWebAppAndCheckForServerNameInResponse (curlCmd , managedServers , 20 ),
496
513
logger ,
497
514
"NGINX can access the test web app from all managed servers {0} in the domain" ,
498
515
managedServers );
@@ -684,16 +701,19 @@ void testMiiMultiClustersRollingRestart() {
684
701
testUntil (
685
702
checkDomainEvent (opNamespace , miiDomainNamespace , miiDomainUid , DOMAIN_CHANGED , "Normal" , timestamp ),
686
703
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 );
689
707
690
708
// wait for longer time for DomainCompleted event
691
709
testUntil (
692
710
withLongRetryPolicy ,
693
711
checkDomainEvent (opNamespace , miiDomainNamespace , miiDomainUid , DOMAIN_PROCESSING_COMPLETED ,
694
712
"Normal" , timestamp ),
695
713
logger ,
696
- DOMAIN_PROCESSING_COMPLETED );
714
+ "domain event {0} to be logged in namespace {1}" ,
715
+ DOMAIN_PROCESSING_COMPLETED ,
716
+ miiDomainNamespace );
697
717
698
718
// Verify that pod termination and started events are logged only once for each managed server in each cluster
699
719
for (int i = 1 ; i <= NUMBER_OF_CLUSTERS_MIIDOMAIN ; i ++) {
@@ -703,20 +723,25 @@ void testMiiMultiClustersRollingRestart() {
703
723
704
724
logger .info ("Checking that managed server pod {0} is terminated and restarted once in namespace {1}" ,
705
725
managedServerPodName , miiDomainNamespace );
726
+ String stopEventMsg = "Stopping container weblogic-server" ;
706
727
testUntil (
707
728
withLongRetryPolicy ,
708
- checkPodEventLoggedOnce (miiDomainNamespace , managedServerPodName , POD_TERMINATED , timestamp ),
729
+ checkPodEventLoggedOnce (miiDomainNamespace , managedServerPodName , POD_TERMINATED , stopEventMsg , timestamp ),
709
730
logger ,
710
- "event {0} to be logged for pod {1}" ,
731
+ "event {0} to be logged for pod {1} in namespace {2} " ,
711
732
POD_TERMINATED ,
712
- managedServerPodName );
733
+ managedServerPodName ,
734
+ miiDomainNamespace );
735
+
736
+ String startedEventMsg = "Started container weblogic-server" ;
713
737
testUntil (
714
738
withLongRetryPolicy ,
715
- checkPodEventLoggedOnce (miiDomainNamespace , managedServerPodName , POD_STARTED , timestamp ),
739
+ checkPodEventLoggedOnce (miiDomainNamespace , managedServerPodName , POD_STARTED , startedEventMsg , timestamp ),
716
740
logger ,
717
- "event {0} to be logged for pod {1}" ,
741
+ "event {0} to be logged for pod {1} in namespace {2} " ,
718
742
POD_STARTED ,
719
- managedServerPodName );
743
+ managedServerPodName ,
744
+ miiDomainNamespace );
720
745
}
721
746
}
722
747
0 commit comments