|
24 | 24 | import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT;
|
25 | 25 | import static oracle.weblogic.kubernetes.TestConstants.ADMIN_SERVER_NAME_BASE;
|
26 | 26 | import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT;
|
| 27 | +import static oracle.weblogic.kubernetes.TestConstants.ISTIO_HTTP_HOSTPORT; |
27 | 28 | import static oracle.weblogic.kubernetes.TestConstants.K8S_NODEPORT_HOST;
|
28 | 29 | import static oracle.weblogic.kubernetes.TestConstants.MANAGED_SERVER_NAME_BASE;
|
29 | 30 | import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER;
|
30 |
| -import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_SLIM; |
31 | 31 | import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR;
|
32 | 32 | import static oracle.weblogic.kubernetes.actions.TestActions.addLabelsToNamespace;
|
33 | 33 | import static oracle.weblogic.kubernetes.utils.ApplicationUtils.checkAppUsingHostHeader;
|
34 | 34 | import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.configIstioModelInImageDomain;
|
35 | 35 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createTestWebAppWarFile;
|
| 36 | +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.formatIPv6Host; |
36 | 37 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.generateNewModelFileWithUpdatedDomainUid;
|
37 | 38 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getServiceExtIPAddrtOke;
|
38 | 39 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.isAppInServerPodReady;
|
@@ -146,9 +147,10 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
|
146 | 147 |
|
147 | 148 | // config the domain with Istio ingress with Istio gateway
|
148 | 149 | String managedServerPrefix = domainUid + "-managed-server";
|
149 |
| - istioIngressPort = assertDoesNotThrow(() -> |
| 150 | + assertDoesNotThrow(() -> |
150 | 151 | configIstioGatewayModelInImageDomain(miiImage, domainNamespace, domainUid, managedServerPrefix),
|
151 | 152 | "setup for istio based domain failed");
|
| 153 | + istioIngressPort = getIstioHttpIngressPort(); |
152 | 154 |
|
153 | 155 | // map to save HTTP response data
|
154 | 156 | httpAttrMap = new HashMap<String, String>();
|
@@ -180,8 +182,8 @@ void testSessionMigrationIstioGateway() {
|
180 | 182 |
|
181 | 183 | // In internal OKE env, use Istio EXTERNAL-IP; in non-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort
|
182 | 184 | String istioIngressIP = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null
|
183 |
| - ? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) : K8S_NODEPORT_HOST; |
184 |
| - |
| 185 | + ? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) : formatIPv6Host(K8S_NODEPORT_HOST); |
| 186 | + |
185 | 187 | // send a HTTP request to set http session state(count number) and save HTTP session info
|
186 | 188 | // before shutting down the primary server
|
187 | 189 | // 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,
|
272 | 274 | int istioIngressPort = getIstioHttpIngressPort();
|
273 | 275 | logger.info("Istio Ingress Port is {0}", istioIngressPort);
|
274 | 276 |
|
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; |
287 | 282 | } else {
|
288 |
| - logger.info("Skipping WebLogic console in WebLogic slim image"); |
| 283 | + host = formatIPv6Host(K8S_NODEPORT_HOST); |
289 | 284 | }
|
| 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"); |
290 | 292 |
|
291 | 293 | Path archivePath = Paths.get(testWebAppWarLoc);
|
292 | 294 | String target = "{identity: [clusters,'" + clusterName + "']}";
|
293 | 295 | // Use WebLogic restful management services to deploy Web App
|
294 | 296 | ExecResult result = OKE_CLUSTER
|
295 | 297 | ? deployUsingRest(hostAndPort, ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT,
|
296 | 298 | target, archivePath, domainNamespace + ".org", "testwebapp")
|
297 |
| - : deployToClusterUsingRest(K8S_NODEPORT_HOST, |
| 299 | + : deployToClusterUsingRest(host, |
298 | 300 | String.valueOf(istioIngressPort),
|
299 | 301 | ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT,
|
300 | 302 | clusterName, archivePath, domainNamespace + ".org", "testwebapp");
|
|
0 commit comments