Skip to content

Commit db00bb3

Browse files
hzhao-githubrjeberhard
authored andcommitted
Completed moving test suites that have LBer installed
1 parent c2c6a08 commit db00bb3

File tree

2 files changed

+36
-13
lines changed

2 files changed

+36
-13
lines changed

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItLBTwoDomainsNginx.java

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import org.junit.jupiter.api.TestMethodOrder;
3333

3434
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;
3537
import static oracle.weblogic.kubernetes.TestConstants.SKIP_CLEANUP;
3638
import static oracle.weblogic.kubernetes.actions.TestActions.createIngress;
3739
import static oracle.weblogic.kubernetes.actions.TestActions.deletePersistentVolume;
@@ -44,6 +46,7 @@
4446
import static oracle.weblogic.kubernetes.utils.CommonLBTestUtils.verifyAdminServerAccess;
4547
import static oracle.weblogic.kubernetes.utils.CommonLBTestUtils.verifyClusterLoadbalancing;
4648
import static oracle.weblogic.kubernetes.utils.CommonLBTestUtils.verifyHeadersInAdminServerLog;
49+
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getServiceExtIPAddrtOke;
4750
import static oracle.weblogic.kubernetes.utils.ImageUtils.createBaseRepoSecret;
4851
import static oracle.weblogic.kubernetes.utils.LoadBalancerUtils.installAndVerifyNginx;
4952
import static oracle.weblogic.kubernetes.utils.OperatorUtils.installAndVerifyOperator;
@@ -61,8 +64,8 @@
6164
@DisplayName("Verify Nginx load balancer handles traffic to two background WebLogic domains")
6265
@IntegrationTest
6366
@Tag("olcne-mrg")
64-
@Tag("oke-parallel")
6567
@Tag("kind-parallel")
68+
@Tag("oke-gate")
6669
class ItLBTwoDomainsNginx {
6770

6871
private static final int numberOfDomains = 2;
@@ -83,6 +86,8 @@ class ItLBTwoDomainsNginx {
8386
private static final int ADMIN_SERVER_PORT = 7001;
8487
private static final String clusterName = "cluster-1";
8588

89+
private static String ingressIP = null;
90+
8691
/**
8792
* Assigns unique namespaces for operator and domains.
8893
* Pull WebLogic image if running tests in Kind cluster.
@@ -130,6 +135,10 @@ public static void initAll(@Namespaces(3) List<String> namespaces) {
130135

131136
// install Nginx ingress controller for all test cases using Nginx
132137
installNginxIngressController();
138+
139+
String ingressServiceName = nginxHelmParams.getHelmParams().getReleaseName() + "-ingress-nginx-controller";
140+
ingressIP = getServiceExtIPAddrtOke(ingressServiceName, nginxNamespace) != null
141+
? getServiceExtIPAddrtOke(ingressServiceName, nginxNamespace) : K8S_NODEPORT_HOST;
133142
}
134143

135144
/**
@@ -143,8 +152,7 @@ void testNginxTLSPathRoutingAdminServer() {
143152
logger.info("Verifying WebLogic admin console is accessible through NGINX path routing with HTTPS protocol");
144153
for (int i = 0; i < numberOfDomains; i++) {
145154
verifyAdminServerAccess(true, getNginxLbNodePort("https"), false, "",
146-
"/" + domainUids.get(i).substring(4) + "console");
147-
155+
"/" + domainUids.get(i).substring(4) + "console", ingressIP);
148156
// verify the header 'WL-Proxy-Client-IP' is removed in the admin server log
149157
// verify the header 'WL-Proxy-SSL: false' is removed in the admin server log
150158
// verify the header 'WL-Proxy-SSL: true' is added in the admin server log
@@ -165,7 +173,7 @@ void testNginxTLSPathRoutingAcrossDomains() {
165173
logger.info("Verifying NGINX path routing with HTTPS protocol across two domains");
166174
for (String domainUid : domainUids) {
167175
verifyClusterLoadbalancing(domainUid, "", "https", getNginxLbNodePort("https"),
168-
replicaCount, false, "/" + domainUid.substring(4));
176+
replicaCount, false, "/" + domainUid.substring(4), ingressIP);
169177
}
170178
}
171179

@@ -183,7 +191,7 @@ void testNginxHttpHostRoutingAcrossDomains() {
183191
for (int i = 0; i < numberOfDomains; i++) {
184192
verifyClusterLoadbalancing(domainUids.get(i),
185193
domainUids.get(i) + "." + domainNamespace + ".nginx.nonssl.test",
186-
"http", getNginxLbNodePort("http"), replicaCount, true, "");
194+
"http", getNginxLbNodePort("http"), replicaCount, true, "", ingressIP);
187195
}
188196
}
189197

@@ -201,7 +209,7 @@ void testNginxHttpsHostRoutingAcrossDomains() {
201209
for (int i = 0; i < numberOfDomains; i++) {
202210
verifyClusterLoadbalancing(domainUids.get(i),
203211
domainUids.get(i) + "." + domainNamespace + ".nginx.ssl.test",
204-
"https", getNginxLbNodePort("https"), replicaCount, true, "");
212+
"https", getNginxLbNodePort("https"), replicaCount, true, "", ingressIP);
205213
}
206214
}
207215

@@ -217,7 +225,7 @@ void testNginxPathRoutingAcrossDomains() {
217225
logger.info("Verifying NGINX path routing with HTTP protocol across two domains");
218226
for (String domainUid : domainUids) {
219227
verifyClusterLoadbalancing(domainUid, "", "http", getNginxLbNodePort("http"),
220-
replicaCount, false, "/" + domainUid.substring(4));
228+
replicaCount, false, "/" + domainUid.substring(4), ingressIP);
221229
}
222230
}
223231

@@ -319,7 +327,9 @@ private static void createNginxIngressHostRoutingForTwoDomains(String ingressCla
319327
ingressHost = domainUid + "." + domainNamespace + ".nginx.nonssl.test";
320328
}
321329

322-
checkIngressReady(true, ingressHost, isTLS, httpNodeport, httpsNodeport, "");
330+
if (!OKE_CLUSTER) {
331+
checkIngressReady(true, ingressHost, isTLS, httpNodeport, httpsNodeport, "");
332+
}
323333
}
324334
}
325335

@@ -370,7 +380,9 @@ private static void createNginxIngressPathRoutingForTwoDomains() {
370380
// check the ingress is ready to route the app to the server pod
371381
int httpNodeport = getNginxLbNodePort("http");
372382
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+
}
374386
}
375387
}
376388

@@ -448,7 +460,9 @@ private static void createNginxTLSPathRoutingForTwoDomains() {
448460
// check the ingress is ready to route the app to the server pod
449461
int httpsNodeport = getNginxLbNodePort("https");
450462
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+
}
452466
}
453467
}
454468

@@ -481,5 +495,4 @@ private static void installNginxIngressController() {
481495
// create ingress rules with TLS path routing for NGINX
482496
createNginxTLSPathRoutingForTwoDomains();
483497
}
484-
485498
}

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItLiftAndShiftFromOnPremDomain.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import static oracle.weblogic.kubernetes.TestConstants.KUBERNETES_CLI;
4141
import static oracle.weblogic.kubernetes.TestConstants.NO_PROXY;
4242
import static oracle.weblogic.kubernetes.TestConstants.OKD;
43+
import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER;
4344
import static oracle.weblogic.kubernetes.TestConstants.OPDEMO;
4445
import static oracle.weblogic.kubernetes.TestConstants.RESULTS_ROOT;
4546
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_REPO_SECRET_NAME;
@@ -59,13 +60,15 @@
5960
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReadyAndServiceExists;
6061
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getActualLocationIfNeeded;
6162
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getHostAndPort;
63+
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getServiceExtIPAddrtOke;
6264
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.testUntil;
6365
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.withQuickRetryPolicy;
6466
import static oracle.weblogic.kubernetes.utils.ExecCommand.exec;
6567
import static oracle.weblogic.kubernetes.utils.FileUtils.copy;
6668
import static oracle.weblogic.kubernetes.utils.FileUtils.copyFolder;
6769
import static oracle.weblogic.kubernetes.utils.FileUtils.createZipFile;
6870
import static oracle.weblogic.kubernetes.utils.FileUtils.replaceStringInFile;
71+
import static oracle.weblogic.kubernetes.utils.ImageUtils.createBaseRepoSecret;
6972
import static oracle.weblogic.kubernetes.utils.ImageUtils.createImageAndVerify;
7073
import static oracle.weblogic.kubernetes.utils.ImageUtils.createTestRepoSecret;
7174
import static oracle.weblogic.kubernetes.utils.ImageUtils.imageRepoLoginAndPushImageToRegistry;
@@ -93,10 +96,10 @@
9396

9497
@DisplayName("Test to validate on-prem to k8s use case")
9598
@Tag("kind-parallel")
96-
@Tag("oke-parallel")
9799
@Tag("toolkits-srg")
98100
@Tag("okd-wls-mrg")
99101
@Tag("olcne-mrg")
102+
@Tag("oke-gate")
100103
@IntegrationTest
101104
class ItLiftAndShiftFromOnPremDomain {
102105
private static String opNamespace = null;
@@ -331,7 +334,9 @@ void testCreateMiiDomainWithClusterFromOnPremDomain() {
331334
hostName = createRouteForOKD(clusterService, domainNamespace);
332335
}
333336

334-
String hostAndPort = getHostAndPort(hostName, traefikNodePort);
337+
final String ingressServiceName = traefikHelmParams.getReleaseName();
338+
String hostAndPort = getServiceExtIPAddrtOke(ingressServiceName, traefikNamespace) != null
339+
? getServiceExtIPAddrtOke(ingressServiceName, traefikNamespace) : getHostAndPort(hostName, traefikNodePort);
335340
logger.info("hostAndPort = {0} ", hostAndPort);
336341

337342
String curlString = String.format("curl -v --show-error --noproxy '*' "
@@ -391,6 +396,11 @@ private static V1Pod callSetupWebLogicPod(String namespace) {
391396
container.addEnvItem(new V1EnvVar().name("no_proxy").value(NO_PROXY));
392397
}
393398

399+
// create secret for internal OKE cluster
400+
if (OKE_CLUSTER) {
401+
createBaseRepoSecret(namespace);
402+
}
403+
394404
return setupWebLogicPod(namespace, container);
395405
}
396406

0 commit comments

Comments
 (0)