Skip to content

Commit 16c7b0e

Browse files
sankarpnjshum2479
authored andcommitted
Podman conversion - ItIstioGatewaySessionMigration, ItStickySession
1 parent 7e6dcdc commit 16c7b0e

File tree

3 files changed

+52
-28
lines changed

3 files changed

+52
-28
lines changed

Jenkinsfile.podman

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ def kind_k8s_map = [
2222
]
2323
]
2424
def _kind_image = null
25-
CRON_SETTINGS = '''H 1 * * * % MAVEN_PROFILE_NAME=wls-srg'''
25+
CRON_SETTINGS = '''H 1 * * * % MAVEN_PROFILE_NAME=kind-parallel
26+
H 2 * * * % MAVEN_PROFILE_NAME=kind-sequential
27+
H 3 * * * % MAVEN_PROFILE_NAME=wls-srg'''
28+
2629
pipeline {
2730
agent { label 'large-ol9' }
2831
options {

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

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,16 @@
2424
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT;
2525
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_SERVER_NAME_BASE;
2626
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT;
27+
import static oracle.weblogic.kubernetes.TestConstants.ISTIO_HTTP_HOSTPORT;
2728
import static oracle.weblogic.kubernetes.TestConstants.K8S_NODEPORT_HOST;
2829
import static oracle.weblogic.kubernetes.TestConstants.MANAGED_SERVER_NAME_BASE;
2930
import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER;
30-
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_SLIM;
3131
import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR;
3232
import static oracle.weblogic.kubernetes.actions.TestActions.addLabelsToNamespace;
3333
import static oracle.weblogic.kubernetes.utils.ApplicationUtils.checkAppUsingHostHeader;
3434
import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.configIstioModelInImageDomain;
3535
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createTestWebAppWarFile;
36+
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.formatIPv6Host;
3637
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.generateNewModelFileWithUpdatedDomainUid;
3738
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getServiceExtIPAddrtOke;
3839
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.isAppInServerPodReady;
@@ -146,9 +147,10 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
146147

147148
// config the domain with Istio ingress with Istio gateway
148149
String managedServerPrefix = domainUid + "-managed-server";
149-
istioIngressPort = assertDoesNotThrow(() ->
150+
assertDoesNotThrow(() ->
150151
configIstioGatewayModelInImageDomain(miiImage, domainNamespace, domainUid, managedServerPrefix),
151152
"setup for istio based domain failed");
153+
istioIngressPort = getIstioHttpIngressPort();
152154

153155
// map to save HTTP response data
154156
httpAttrMap = new HashMap<String, String>();
@@ -180,8 +182,8 @@ void testSessionMigrationIstioGateway() {
180182

181183
// In internal OKE env, use Istio EXTERNAL-IP; in non-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort
182184
String istioIngressIP = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null
183-
? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) : K8S_NODEPORT_HOST;
184-
185+
? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) : formatIPv6Host(K8S_NODEPORT_HOST);
186+
185187
// send a HTTP request to set http session state(count number) and save HTTP session info
186188
// before shutting down the primary server
187189
// the NodePort services created by the operator are not usable, because they would expose ports
@@ -272,29 +274,29 @@ private static int configIstioGatewayModelInImageDomain(String miiImage,
272274
int istioIngressPort = getIstioHttpIngressPort();
273275
logger.info("Istio Ingress Port is {0}", istioIngressPort);
274276

275-
// In internal OKE env, use Istio EXTERNAL-IP; in non-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort
276-
String hostAndPort = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null
277-
? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace)
278-
: K8S_NODEPORT_HOST + ":" + istioIngressPort;
279-
280-
// We can not verify Rest Management console thru Adminstration NodePort
281-
// in istio, as we can not enable Adminstration NodePort
282-
if (!WEBLOGIC_SLIM) {
283-
String consoleUrl = "http://" + hostAndPort + "/console/login/LoginForm.jsp";
284-
boolean checkConsole = checkAppUsingHostHeader(consoleUrl, domainNamespace + ".org");
285-
assertTrue(checkConsole, "Failed to access WebLogic console");
286-
logger.info("WebLogic console is accessible");
277+
String host;
278+
if (TestConstants.KIND_CLUSTER
279+
&& !TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
280+
host = "localhost";
281+
istioIngressPort = ISTIO_HTTP_HOSTPORT;
287282
} else {
288-
logger.info("Skipping WebLogic console in WebLogic slim image");
283+
host = formatIPv6Host(K8S_NODEPORT_HOST);
289284
}
285+
// In internal OKE env, use Istio EXTERNAL-IP; in non-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort
286+
String hostAndPort = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null
287+
? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) : host + ":" + istioIngressPort;
288+
289+
String restUrl = "http://" + hostAndPort + "/management/tenant-monitoring/servers/";
290+
boolean checkConsole = checkAppUsingHostHeader(restUrl, domainNamespace + ".org");
291+
assertTrue(checkConsole, "Failed to access WebLogic REST interface");
290292

291293
Path archivePath = Paths.get(testWebAppWarLoc);
292294
String target = "{identity: [clusters,'" + clusterName + "']}";
293295
// Use WebLogic restful management services to deploy Web App
294296
ExecResult result = OKE_CLUSTER
295297
? deployUsingRest(hostAndPort, ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT,
296298
target, archivePath, domainNamespace + ".org", "testwebapp")
297-
: deployToClusterUsingRest(K8S_NODEPORT_HOST,
299+
: deployToClusterUsingRest(host,
298300
String.valueOf(istioIngressPort),
299301
ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT,
300302
clusterName, archivePath, domainNamespace + ".org", "testwebapp");

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

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
package oracle.weblogic.kubernetes;
55

6+
import java.net.InetAddress;
67
import java.util.HashMap;
78
import java.util.List;
89
import java.util.Map;
@@ -136,7 +137,8 @@ public static void init(@Namespaces(3) List<String> namespaces) {
136137
domainNamespace = namespaces.get(2);
137138

138139
// install and verify Traefik
139-
if (!OKD) {
140+
if (!OKD && !(TestConstants.KIND_CLUSTER
141+
&& !TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT))) {
140142
traefikHelmParams =
141143
installAndVerifyTraefik(traefikNamespace, 0, 0).getHelmParams();
142144
}
@@ -180,12 +182,19 @@ void tearDown() {
180182
@DisplayName("Create a Traefik ingress resource and verify that two HTTP connections are sticky to the same server")
181183
@DisabledIfEnvironmentVariable(named = "OKD", matches = "true")
182184
void testSameSessionStickinessUsingTraefik() {
183-
final String ingressServiceName = traefikHelmParams.getReleaseName();
185+
184186
final String channelName = "web";
185187

186188
// create Traefik ingress resource
187189
final String ingressResourceFileName = "traefik/traefik-ingress-rules-stickysession.yaml";
188-
createTraefikIngressRoutingRules(domainNamespace, traefikNamespace, ingressResourceFileName, domainUid);
190+
String traefikns;
191+
if (TestConstants.KIND_CLUSTER
192+
&& !TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
193+
traefikns = TestConstants.TRAEFIK_NAMESPACE;
194+
} else {
195+
traefikns = traefikNamespace;
196+
}
197+
createTraefikIngressRoutingRules(domainNamespace, traefikns, ingressResourceFileName, domainUid);
189198

190199
String hostName = new StringBuffer()
191200
.append(domainUid)
@@ -196,8 +205,15 @@ void testSameSessionStickinessUsingTraefik() {
196205
.append(".test").toString();
197206

198207
// get Traefik ingress service Nodeport
199-
int ingressServiceNodePort =
200-
getIngressServiceNodePort(traefikNamespace, ingressServiceName, channelName);
208+
int ingressServiceNodePort;
209+
if (TestConstants.KIND_CLUSTER
210+
&& !TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
211+
ingressServiceNodePort = TestConstants.TRAEFIK_INGRESS_HTTP_HOSTPORT;
212+
} else {
213+
final String ingressServiceName = traefikHelmParams.getReleaseName();
214+
ingressServiceNodePort
215+
= getIngressServiceNodePort(traefikNamespace, ingressServiceName, channelName);
216+
}
201217

202218
// verify that two HTTP connections are sticky to the same server
203219
sendHttpRequestsToTestSessionStickinessAndVerify(hostName, ingressServiceNodePort);
@@ -461,15 +477,18 @@ private static String buildCurlCommand(String hostName,
461477
final String httpHeaderFile = LOGS_DIR + "/headers";
462478
logger.info("Build a curl command with hostname {0} and port {1}", hostName, servicePort);
463479

464-
if (!OKD) {
480+
if (TestConstants.KIND_CLUSTER
481+
&& !TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
482+
hostAndPort = assertDoesNotThrow(() -> InetAddress.getLocalHost().getHostAddress()
483+
+ ":" + TestConstants.TRAEFIK_INGRESS_HTTP_HOSTPORT);
484+
} else if (OKD) {
485+
hostAndPort = getHostAndPort(hostName, servicePort);
486+
} else {
465487
final String ingressServiceName = traefikHelmParams.getReleaseName();
466488
hostAndPort = getServiceExtIPAddrtOke(ingressServiceName, traefikNamespace) != null
467489
? getServiceExtIPAddrtOke(ingressServiceName, traefikNamespace) : getHostAndPort(hostName, servicePort);
468-
} else {
469-
hostAndPort = getHostAndPort(hostName, servicePort);
470490
}
471491

472-
473492
curlCmd.append(" --noproxy '*' -H 'host: ")
474493
.append(hostName)
475494
.append("' http://")

0 commit comments

Comments
 (0)