Skip to content

Commit

Permalink
Merge branch 'move-to-oke-lber-p3' into 'main'
Browse files Browse the repository at this point in the history
Completed moving test suites that have LBer installed

See merge request weblogic-cloud/weblogic-kubernetes-operator!4457
  • Loading branch information
rjeberhard committed Oct 6, 2023
2 parents c2c6a08 + db00bb3 commit ac51762
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import org.junit.jupiter.api.TestMethodOrder;

import static oracle.weblogic.kubernetes.TestConstants.ADMIN_SERVER_NAME_BASE;
import static oracle.weblogic.kubernetes.TestConstants.K8S_NODEPORT_HOST;
import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER;
import static oracle.weblogic.kubernetes.TestConstants.SKIP_CLEANUP;
import static oracle.weblogic.kubernetes.actions.TestActions.createIngress;
import static oracle.weblogic.kubernetes.actions.TestActions.deletePersistentVolume;
Expand All @@ -44,6 +46,7 @@
import static oracle.weblogic.kubernetes.utils.CommonLBTestUtils.verifyAdminServerAccess;
import static oracle.weblogic.kubernetes.utils.CommonLBTestUtils.verifyClusterLoadbalancing;
import static oracle.weblogic.kubernetes.utils.CommonLBTestUtils.verifyHeadersInAdminServerLog;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getServiceExtIPAddrtOke;
import static oracle.weblogic.kubernetes.utils.ImageUtils.createBaseRepoSecret;
import static oracle.weblogic.kubernetes.utils.LoadBalancerUtils.installAndVerifyNginx;
import static oracle.weblogic.kubernetes.utils.OperatorUtils.installAndVerifyOperator;
Expand All @@ -61,8 +64,8 @@
@DisplayName("Verify Nginx load balancer handles traffic to two background WebLogic domains")
@IntegrationTest
@Tag("olcne-mrg")
@Tag("oke-parallel")
@Tag("kind-parallel")
@Tag("oke-gate")
class ItLBTwoDomainsNginx {

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

private static String ingressIP = null;

/**
* Assigns unique namespaces for operator and domains.
* Pull WebLogic image if running tests in Kind cluster.
Expand Down Expand Up @@ -130,6 +135,10 @@ public static void initAll(@Namespaces(3) List<String> namespaces) {

// install Nginx ingress controller for all test cases using Nginx
installNginxIngressController();

String ingressServiceName = nginxHelmParams.getHelmParams().getReleaseName() + "-ingress-nginx-controller";
ingressIP = getServiceExtIPAddrtOke(ingressServiceName, nginxNamespace) != null
? getServiceExtIPAddrtOke(ingressServiceName, nginxNamespace) : K8S_NODEPORT_HOST;
}

/**
Expand All @@ -143,8 +152,7 @@ void testNginxTLSPathRoutingAdminServer() {
logger.info("Verifying WebLogic admin console is accessible through NGINX path routing with HTTPS protocol");
for (int i = 0; i < numberOfDomains; i++) {
verifyAdminServerAccess(true, getNginxLbNodePort("https"), false, "",
"/" + domainUids.get(i).substring(4) + "console");

"/" + domainUids.get(i).substring(4) + "console", ingressIP);
// verify the header 'WL-Proxy-Client-IP' is removed in the admin server log
// verify the header 'WL-Proxy-SSL: false' is removed in the admin server log
// verify the header 'WL-Proxy-SSL: true' is added in the admin server log
Expand All @@ -165,7 +173,7 @@ void testNginxTLSPathRoutingAcrossDomains() {
logger.info("Verifying NGINX path routing with HTTPS protocol across two domains");
for (String domainUid : domainUids) {
verifyClusterLoadbalancing(domainUid, "", "https", getNginxLbNodePort("https"),
replicaCount, false, "/" + domainUid.substring(4));
replicaCount, false, "/" + domainUid.substring(4), ingressIP);
}
}

Expand All @@ -183,7 +191,7 @@ void testNginxHttpHostRoutingAcrossDomains() {
for (int i = 0; i < numberOfDomains; i++) {
verifyClusterLoadbalancing(domainUids.get(i),
domainUids.get(i) + "." + domainNamespace + ".nginx.nonssl.test",
"http", getNginxLbNodePort("http"), replicaCount, true, "");
"http", getNginxLbNodePort("http"), replicaCount, true, "", ingressIP);
}
}

Expand All @@ -201,7 +209,7 @@ void testNginxHttpsHostRoutingAcrossDomains() {
for (int i = 0; i < numberOfDomains; i++) {
verifyClusterLoadbalancing(domainUids.get(i),
domainUids.get(i) + "." + domainNamespace + ".nginx.ssl.test",
"https", getNginxLbNodePort("https"), replicaCount, true, "");
"https", getNginxLbNodePort("https"), replicaCount, true, "", ingressIP);
}
}

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

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

checkIngressReady(true, ingressHost, isTLS, httpNodeport, httpsNodeport, "");
if (!OKE_CLUSTER) {
checkIngressReady(true, ingressHost, isTLS, httpNodeport, httpsNodeport, "");
}
}
}

Expand Down Expand Up @@ -370,7 +380,9 @@ private static void createNginxIngressPathRoutingForTwoDomains() {
// check the ingress is ready to route the app to the server pod
int httpNodeport = getNginxLbNodePort("http");
for (String domainUid : domainUids) {
checkIngressReady(false, "", false, httpNodeport, -1, domainUid.substring(4));
if (!OKE_CLUSTER) {
checkIngressReady(false, "", false, httpNodeport, -1, domainUid.substring(4));
}
}
}

Expand Down Expand Up @@ -448,7 +460,9 @@ private static void createNginxTLSPathRoutingForTwoDomains() {
// check the ingress is ready to route the app to the server pod
int httpsNodeport = getNginxLbNodePort("https");
for (String domainUid : domainUids) {
checkIngressReady(false, "", true, -1, httpsNodeport, domainUid.substring(4));
if (!OKE_CLUSTER) {
checkIngressReady(false, "", true, -1, httpsNodeport, domainUid.substring(4));
}
}
}

Expand Down Expand Up @@ -481,5 +495,4 @@ private static void installNginxIngressController() {
// create ingress rules with TLS path routing for NGINX
createNginxTLSPathRoutingForTwoDomains();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import static oracle.weblogic.kubernetes.TestConstants.KUBERNETES_CLI;
import static oracle.weblogic.kubernetes.TestConstants.NO_PROXY;
import static oracle.weblogic.kubernetes.TestConstants.OKD;
import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER;
import static oracle.weblogic.kubernetes.TestConstants.OPDEMO;
import static oracle.weblogic.kubernetes.TestConstants.RESULTS_ROOT;
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_REPO_SECRET_NAME;
Expand All @@ -59,13 +60,15 @@
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReadyAndServiceExists;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getActualLocationIfNeeded;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getHostAndPort;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getServiceExtIPAddrtOke;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.testUntil;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.withQuickRetryPolicy;
import static oracle.weblogic.kubernetes.utils.ExecCommand.exec;
import static oracle.weblogic.kubernetes.utils.FileUtils.copy;
import static oracle.weblogic.kubernetes.utils.FileUtils.copyFolder;
import static oracle.weblogic.kubernetes.utils.FileUtils.createZipFile;
import static oracle.weblogic.kubernetes.utils.FileUtils.replaceStringInFile;
import static oracle.weblogic.kubernetes.utils.ImageUtils.createBaseRepoSecret;
import static oracle.weblogic.kubernetes.utils.ImageUtils.createImageAndVerify;
import static oracle.weblogic.kubernetes.utils.ImageUtils.createTestRepoSecret;
import static oracle.weblogic.kubernetes.utils.ImageUtils.imageRepoLoginAndPushImageToRegistry;
Expand Down Expand Up @@ -93,10 +96,10 @@

@DisplayName("Test to validate on-prem to k8s use case")
@Tag("kind-parallel")
@Tag("oke-parallel")
@Tag("toolkits-srg")
@Tag("okd-wls-mrg")
@Tag("olcne-mrg")
@Tag("oke-gate")
@IntegrationTest
class ItLiftAndShiftFromOnPremDomain {
private static String opNamespace = null;
Expand Down Expand Up @@ -331,7 +334,9 @@ void testCreateMiiDomainWithClusterFromOnPremDomain() {
hostName = createRouteForOKD(clusterService, domainNamespace);
}

String hostAndPort = getHostAndPort(hostName, traefikNodePort);
final String ingressServiceName = traefikHelmParams.getReleaseName();
String hostAndPort = getServiceExtIPAddrtOke(ingressServiceName, traefikNamespace) != null
? getServiceExtIPAddrtOke(ingressServiceName, traefikNamespace) : getHostAndPort(hostName, traefikNodePort);
logger.info("hostAndPort = {0} ", hostAndPort);

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

// create secret for internal OKE cluster
if (OKE_CLUSTER) {
createBaseRepoSecret(namespace);
}

return setupWebLogicPod(namespace, container);
}

Expand Down

0 comments on commit ac51762

Please sign in to comment.