32
32
import org .junit .jupiter .api .TestMethodOrder ;
33
33
34
34
import static oracle .weblogic .kubernetes .TestConstants .ADMIN_SERVER_NAME_BASE ;
35
+ import static oracle .weblogic .kubernetes .TestConstants .K8S_NODEPORT_HOST ;
36
+ import static oracle .weblogic .kubernetes .TestConstants .OKE_CLUSTER ;
35
37
import static oracle .weblogic .kubernetes .TestConstants .SKIP_CLEANUP ;
36
38
import static oracle .weblogic .kubernetes .actions .TestActions .createIngress ;
37
39
import static oracle .weblogic .kubernetes .actions .TestActions .deletePersistentVolume ;
44
46
import static oracle .weblogic .kubernetes .utils .CommonLBTestUtils .verifyAdminServerAccess ;
45
47
import static oracle .weblogic .kubernetes .utils .CommonLBTestUtils .verifyClusterLoadbalancing ;
46
48
import static oracle .weblogic .kubernetes .utils .CommonLBTestUtils .verifyHeadersInAdminServerLog ;
49
+ import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getServiceExtIPAddrtOke ;
47
50
import static oracle .weblogic .kubernetes .utils .ImageUtils .createBaseRepoSecret ;
48
51
import static oracle .weblogic .kubernetes .utils .LoadBalancerUtils .installAndVerifyNginx ;
49
52
import static oracle .weblogic .kubernetes .utils .OperatorUtils .installAndVerifyOperator ;
61
64
@ DisplayName ("Verify Nginx load balancer handles traffic to two background WebLogic domains" )
62
65
@ IntegrationTest
63
66
@ Tag ("olcne-mrg" )
64
- @ Tag ("oke-parallel" )
65
67
@ Tag ("kind-parallel" )
68
+ @ Tag ("oke-gate" )
66
69
class ItLBTwoDomainsNginx {
67
70
68
71
private static final int numberOfDomains = 2 ;
@@ -83,6 +86,8 @@ class ItLBTwoDomainsNginx {
83
86
private static final int ADMIN_SERVER_PORT = 7001 ;
84
87
private static final String clusterName = "cluster-1" ;
85
88
89
+ private static String ingressIP = null ;
90
+
86
91
/**
87
92
* Assigns unique namespaces for operator and domains.
88
93
* Pull WebLogic image if running tests in Kind cluster.
@@ -130,6 +135,10 @@ public static void initAll(@Namespaces(3) List<String> namespaces) {
130
135
131
136
// install Nginx ingress controller for all test cases using Nginx
132
137
installNginxIngressController ();
138
+
139
+ String ingressServiceName = nginxHelmParams .getHelmParams ().getReleaseName () + "-ingress-nginx-controller" ;
140
+ ingressIP = getServiceExtIPAddrtOke (ingressServiceName , nginxNamespace ) != null
141
+ ? getServiceExtIPAddrtOke (ingressServiceName , nginxNamespace ) : K8S_NODEPORT_HOST ;
133
142
}
134
143
135
144
/**
@@ -143,8 +152,7 @@ void testNginxTLSPathRoutingAdminServer() {
143
152
logger .info ("Verifying WebLogic admin console is accessible through NGINX path routing with HTTPS protocol" );
144
153
for (int i = 0 ; i < numberOfDomains ; i ++) {
145
154
verifyAdminServerAccess (true , getNginxLbNodePort ("https" ), false , "" ,
146
- "/" + domainUids .get (i ).substring (4 ) + "console" );
147
-
155
+ "/" + domainUids .get (i ).substring (4 ) + "console" , ingressIP );
148
156
// verify the header 'WL-Proxy-Client-IP' is removed in the admin server log
149
157
// verify the header 'WL-Proxy-SSL: false' is removed in the admin server log
150
158
// verify the header 'WL-Proxy-SSL: true' is added in the admin server log
@@ -165,7 +173,7 @@ void testNginxTLSPathRoutingAcrossDomains() {
165
173
logger .info ("Verifying NGINX path routing with HTTPS protocol across two domains" );
166
174
for (String domainUid : domainUids ) {
167
175
verifyClusterLoadbalancing (domainUid , "" , "https" , getNginxLbNodePort ("https" ),
168
- replicaCount , false , "/" + domainUid .substring (4 ));
176
+ replicaCount , false , "/" + domainUid .substring (4 ), ingressIP );
169
177
}
170
178
}
171
179
@@ -183,7 +191,7 @@ void testNginxHttpHostRoutingAcrossDomains() {
183
191
for (int i = 0 ; i < numberOfDomains ; i ++) {
184
192
verifyClusterLoadbalancing (domainUids .get (i ),
185
193
domainUids .get (i ) + "." + domainNamespace + ".nginx.nonssl.test" ,
186
- "http" , getNginxLbNodePort ("http" ), replicaCount , true , "" );
194
+ "http" , getNginxLbNodePort ("http" ), replicaCount , true , "" , ingressIP );
187
195
}
188
196
}
189
197
@@ -201,7 +209,7 @@ void testNginxHttpsHostRoutingAcrossDomains() {
201
209
for (int i = 0 ; i < numberOfDomains ; i ++) {
202
210
verifyClusterLoadbalancing (domainUids .get (i ),
203
211
domainUids .get (i ) + "." + domainNamespace + ".nginx.ssl.test" ,
204
- "https" , getNginxLbNodePort ("https" ), replicaCount , true , "" );
212
+ "https" , getNginxLbNodePort ("https" ), replicaCount , true , "" , ingressIP );
205
213
}
206
214
}
207
215
@@ -217,7 +225,7 @@ void testNginxPathRoutingAcrossDomains() {
217
225
logger .info ("Verifying NGINX path routing with HTTP protocol across two domains" );
218
226
for (String domainUid : domainUids ) {
219
227
verifyClusterLoadbalancing (domainUid , "" , "http" , getNginxLbNodePort ("http" ),
220
- replicaCount , false , "/" + domainUid .substring (4 ));
228
+ replicaCount , false , "/" + domainUid .substring (4 ), ingressIP );
221
229
}
222
230
}
223
231
@@ -319,7 +327,9 @@ private static void createNginxIngressHostRoutingForTwoDomains(String ingressCla
319
327
ingressHost = domainUid + "." + domainNamespace + ".nginx.nonssl.test" ;
320
328
}
321
329
322
- checkIngressReady (true , ingressHost , isTLS , httpNodeport , httpsNodeport , "" );
330
+ if (!OKE_CLUSTER ) {
331
+ checkIngressReady (true , ingressHost , isTLS , httpNodeport , httpsNodeport , "" );
332
+ }
323
333
}
324
334
}
325
335
@@ -370,7 +380,9 @@ private static void createNginxIngressPathRoutingForTwoDomains() {
370
380
// check the ingress is ready to route the app to the server pod
371
381
int httpNodeport = getNginxLbNodePort ("http" );
372
382
for (String domainUid : domainUids ) {
373
- checkIngressReady (false , "" , false , httpNodeport , -1 , domainUid .substring (4 ));
383
+ if (!OKE_CLUSTER ) {
384
+ checkIngressReady (false , "" , false , httpNodeport , -1 , domainUid .substring (4 ));
385
+ }
374
386
}
375
387
}
376
388
@@ -448,7 +460,9 @@ private static void createNginxTLSPathRoutingForTwoDomains() {
448
460
// check the ingress is ready to route the app to the server pod
449
461
int httpsNodeport = getNginxLbNodePort ("https" );
450
462
for (String domainUid : domainUids ) {
451
- checkIngressReady (false , "" , true , -1 , httpsNodeport , domainUid .substring (4 ));
463
+ if (!OKE_CLUSTER ) {
464
+ checkIngressReady (false , "" , true , -1 , httpsNodeport , domainUid .substring (4 ));
465
+ }
452
466
}
453
467
}
454
468
@@ -481,5 +495,4 @@ private static void installNginxIngressController() {
481
495
// create ingress rules with TLS path routing for NGINX
482
496
createNginxTLSPathRoutingForTwoDomains ();
483
497
}
484
-
485
498
}
0 commit comments