From e2f98c76b091ccd63b9c4ff5364ebfb1a9600cd9 Mon Sep 17 00:00:00 2001 From: huiling_zhao Date: Tue, 8 Oct 2024 22:33:26 +0000 Subject: [PATCH] OWLS-121702 - [wko-nightly] ItIstioDBOperator tests are failing on release/4.2 OKE nightly --- .../kubernetes/ItIstioDBOperator.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDBOperator.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDBOperator.java index 64f172f0a94..a819302f3a6 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDBOperator.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDBOperator.java @@ -74,6 +74,7 @@ import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createTestWebAppWarFile; import static oracle.weblogic.kubernetes.utils.CommonTestUtils.formatIPv6Host; import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getHostAndPort; +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getServiceExtIPAddrtOke; import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getUniqueName; import static oracle.weblogic.kubernetes.utils.CommonTestUtils.runClientInsidePod; import static oracle.weblogic.kubernetes.utils.CommonTestUtils.runJavacInsidePod; @@ -139,6 +140,9 @@ class ItIstioDBOperator { private static String hostHeader; Map httpHeaders; + private static final String istioNamespace = "istio-system"; + private static final String istioIngressServiceName = "istio-ingressgateway"; + /** * Start DB service and create RCU schema. * Assigns unique namespaces for operator and domains. @@ -418,7 +422,11 @@ private void runJmsClientOnAdminPod(String action, String queue) { * @returns true if MBean is found otherwise false **/ private boolean checkJmsServerRuntime(String jmsServer, String managedServer) throws UnknownHostException { - String hostAndPort = getHostAndPort(adminSvcExtRouteHost, wlDomainIstioIngressPort); + // In internal OKE env, use Istio EXTERNAL-IP; in non-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort + String hostAndPort = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null + ? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) + : getHostAndPort(adminSvcExtRouteHost, wlDomainIstioIngressPort); + if (!TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) { hostAndPort = formatIPv6Host(InetAddress.getLocalHost().getHostAddress()) + ":" + ISTIO_HTTP_HOSTPORT; } @@ -437,7 +445,10 @@ private boolean checkJmsServerRuntime(String jmsServer, String managedServer) th * @returns true if MBean is found otherwise false **/ private boolean checkStoreRuntime(String storeName, String managedServer) throws UnknownHostException { - String hostAndPort = getHostAndPort(adminSvcExtRouteHost, wlDomainIstioIngressPort); + String hostAndPort = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null + ? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) + : getHostAndPort(adminSvcExtRouteHost, wlDomainIstioIngressPort); + if (!TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) { hostAndPort = formatIPv6Host(InetAddress.getLocalHost().getHostAddress()) + ":" + ISTIO_HTTP_HOSTPORT; } @@ -458,9 +469,13 @@ private boolean checkStoreRuntime(String storeName, String managedServer) throws * @returns true if MBean is found otherwise false **/ private boolean checkJtaRecoveryServiceRuntime(String managedServer, - String recoveryService, String active) throws UnknownHostException { + String recoveryService, + String active) throws UnknownHostException { - String hostAndPort = getHostAndPort(adminSvcExtRouteHost, wlDomainIstioIngressPort); + String hostAndPort = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null + ? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) + : getHostAndPort(adminSvcExtRouteHost, wlDomainIstioIngressPort); + if (!TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) { hostAndPort = formatIPv6Host(InetAddress.getLocalHost().getHostAddress()) + ":" + ISTIO_HTTP_HOSTPORT; }