Skip to content

Commit a7a52cb

Browse files
vanajamukkararjeberhard
authored andcommitted
changes to replace console access check with ready app check
1 parent c861fea commit a7a52cb

21 files changed

+227
-301
lines changed

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import oracle.weblogic.domain.ServerPod;
2929
import oracle.weblogic.kubernetes.annotations.IntegrationTest;
3030
import oracle.weblogic.kubernetes.annotations.Namespaces;
31-
import oracle.weblogic.kubernetes.assertions.TestAssertions;
3231
import oracle.weblogic.kubernetes.logging.LoggingFacade;
3332
import oracle.weblogic.kubernetes.utils.ExecResult;
3433
import org.junit.jupiter.api.BeforeAll;
@@ -45,7 +44,6 @@
4544
import static oracle.weblogic.kubernetes.TestConstants.IMAGE_PULL_POLICY;
4645
import static oracle.weblogic.kubernetes.TestConstants.RESULTS_ROOT;
4746
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_REPO_SECRET_NAME;
48-
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_SLIM;
4947
import static oracle.weblogic.kubernetes.actions.ActionConstants.APP_DIR;
5048
import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR;
5149
import static oracle.weblogic.kubernetes.actions.ActionConstants.WORK_DIR;
@@ -549,23 +547,6 @@ private static void createDomain(String domainUid, String domainNamespace, Strin
549547
assertDoesNotThrow(
550548
() -> exec(command, true));
551549

552-
logger.info("Getting node port");
553-
int serviceNodePort = assertDoesNotThrow(() -> getServiceNodePort(domainNamespace,
554-
getExternalServicePodName(adminServerPodName), "default"),
555-
"Getting admin server node port failed");
556-
557-
if (!WEBLOGIC_SLIM) {
558-
logger.info("Validating WebLogic admin console");
559-
testUntil(
560-
assertDoesNotThrow(() -> {
561-
return TestAssertions.adminNodePortAccessible(serviceNodePort,
562-
ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, adminExtSvcRouteHost);
563-
}, "Access to admin server node port failed"),
564-
logger,
565-
"Console login validation");
566-
} else {
567-
logger.info("Skipping WebLogic Console check for Weblogic slim images");
568-
}
569550
}
570551

571552
private static void createDomainResource(String domainUid, String domNamespace, String adminSecretName,

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

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER;
4747
import static oracle.weblogic.kubernetes.TestConstants.RESULTS_ROOT;
4848
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_REPO_SECRET_NAME;
49-
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_SLIM;
5049
import static oracle.weblogic.kubernetes.actions.ActionConstants.APP_DIR;
5150
import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR;
5251
import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR;
@@ -363,28 +362,23 @@ private static void buildApplicationsAndDomains() {
363362
istioIngressPort = getIstioHttpIngressPort();
364363
logger.info("Istio Ingress Port is {0}", istioIngressPort);
365364

366-
// We can not verify Rest Management console thru Adminstration NodePort
367-
// in istio, as we can not enable Adminstration NodePort
368-
if (!WEBLOGIC_SLIM) {
369-
String host = K8S_NODEPORT_HOST;
370-
if (host.contains(":")) {
371-
// use IPV6
372-
host = "[" + host + "]";
373-
}
374-
375-
// In internal OKE env, use Istio EXTERNAL-IP; in non-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort
376-
String hostAndPort = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null
377-
? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) : host + ":" + istioIngressPort;
378-
379-
String consoleUrl = "http://" + hostAndPort + "/console/login/LoginForm.jsp";
380-
381-
boolean checkConsole =
382-
checkAppUsingHostHeader(consoleUrl, "domain1-" + domain1Namespace + ".org");
383-
assertTrue(checkConsole, "Failed to access WebLogic console on domain1");
384-
logger.info("WebLogic console on domain1 is accessible");
385-
} else {
386-
logger.info("Skipping WebLogic console in WebLogic slim image");
365+
String host = K8S_NODEPORT_HOST;
366+
if (host.contains(":")) {
367+
// use IPV6
368+
host = "[" + host + "]";
387369
}
370+
371+
// In internal OKE env, use Istio EXTERNAL-IP; in non-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort
372+
String hostAndPort = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null
373+
? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) : host + ":" + istioIngressPort;
374+
375+
String readyAppUrl = "http://" + hostAndPort + "/weblogic/ready";
376+
377+
boolean checkReadyApp =
378+
checkAppUsingHostHeader(readyAppUrl, "domain1-" + domain1Namespace + ".org");
379+
assertTrue(checkReadyApp, "Failed to access ready app on domain1");
380+
logger.info("ready app on domain1 is accessible");
381+
388382
}
389383

390384
/*

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

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import static oracle.weblogic.kubernetes.TestConstants.WDT_BASIC_IMAGE_NAME;
3939
import static oracle.weblogic.kubernetes.TestConstants.WDT_BASIC_IMAGE_TAG;
4040
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TAG;
41-
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_SLIM;
4241
import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR;
4342
import static oracle.weblogic.kubernetes.actions.TestActions.addLabelsToNamespace;
4443
import static oracle.weblogic.kubernetes.actions.TestActions.createDomainCustomResource;
@@ -128,8 +127,8 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
128127
* Do not add any AdminService under AdminServer configuration
129128
* Deploy istio gateways and virtual service
130129
* Verify server pods are in ready state and services are created.
131-
* Verify WebLogic console is accessible thru istio ingress http port
132-
* Verify WebLogic console is accessible thru kubectl forwarded port(s)
130+
* Verify ready app is accessible thru istio ingress http port
131+
* Verify ready app is accessible thru kubectl forwarded port(s)
133132
* Deploy a web application thru istio http ingress port using REST api
134133
* Access web application thru istio http ingress port using curl
135134
* Verify Security Warning Tool does not detect any security warning message
@@ -212,36 +211,31 @@ void testIstioDomainHomeInImage() {
212211
// in non-internal-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort
213212
String hostAndPort = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null
214213
? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) : host + ":" + istioIngressPort;
215-
216-
// We can not verify Rest Management console thru Adminstration NodePort
217-
// in istio, as we can not enable Adminstration NodePort
218-
if (!WEBLOGIC_SLIM) {
219-
String consoleUrl = "http://" + hostAndPort + "/console/login/LoginForm.jsp";
220-
boolean checkConsole = checkAppUsingHostHeader(consoleUrl, domainNamespace + ".org");
221-
assertTrue(checkConsole, "Failed to access WebLogic console");
222-
logger.info("WebLogic console is accessible");
223-
String localhost = "localhost";
224-
// Forward the non-ssl port 7001
225-
String forwardPort = startPortForwardProcess(localhost, domainNamespace, domainUid, 7001);
226-
assertNotNull(forwardPort, "port-forward fails to assign local port");
227-
logger.info("Forwarded local port is {0}", forwardPort);
228-
consoleUrl = "http://" + localhost + ":" + forwardPort + "/console/login/LoginForm.jsp";
229-
checkConsole = checkAppUsingHostHeader(consoleUrl, domainNamespace + ".org");
230-
assertTrue(checkConsole, "Failed to access WebLogic console thru port-forwarded port");
231-
logger.info("WebLogic console is accessible thru non-ssl port forwarding");
232-
// Forward the ssl port 7002
233-
forwardPort = startPortForwardProcess(localhost, domainNamespace, domainUid, 7002);
234-
assertNotNull(forwardPort, "(ssl) port-forward fails to assign local port");
235-
logger.info("Forwarded local port is {0}", forwardPort);
236-
consoleUrl = "https://" + localhost + ":" + forwardPort + "/console/login/LoginForm.jsp";
237-
checkConsole = checkAppUsingHostHeader(consoleUrl, domainNamespace + ".org");
238-
assertTrue(checkConsole, "Failed to access WebLogic console thru port-forwarded port");
239-
logger.info("WebLogic console is accessible thru ssl port forwarding");
240-
241-
stopPortForwardProcess(domainNamespace);
242-
} else {
243-
logger.info("Skipping WebLogic console in WebLogic slim image");
244-
}
214+
215+
String readyAppUrl = "http://" + hostAndPort + "/weblogic/ready";
216+
boolean checkReadyApp = checkAppUsingHostHeader(readyAppUrl, domainNamespace + ".org");
217+
assertTrue(checkReadyApp, "Failed to access ready app");
218+
logger.info("ready app is accessible");
219+
String localhost = "localhost";
220+
// Forward the non-ssl port 7001
221+
String forwardPort = startPortForwardProcess(localhost, domainNamespace, domainUid, 7001);
222+
assertNotNull(forwardPort, "port-forward fails to assign local port");
223+
logger.info("Forwarded local port is {0}", forwardPort);
224+
readyAppUrl = "http://" + localhost + ":" + forwardPort + "/weblogic/ready";
225+
checkReadyApp = checkAppUsingHostHeader(readyAppUrl, domainNamespace + ".org");
226+
assertTrue(checkReadyApp, "Failed to access ready app thru port-forwarded port");
227+
logger.info("ready app is accessible thru non-ssl port forwarding");
228+
// Forward the ssl port 7002
229+
forwardPort = startPortForwardProcess(localhost, domainNamespace, domainUid, 7002);
230+
assertNotNull(forwardPort, "(ssl) port-forward fails to assign local port");
231+
logger.info("Forwarded local port is {0}", forwardPort);
232+
readyAppUrl = "https://" + localhost + ":" + forwardPort + "/weblogic/ready";
233+
checkReadyApp = checkAppUsingHostHeader(readyAppUrl, domainNamespace + ".org");
234+
assertTrue(checkReadyApp, "Failed to access ready app thru port-forwarded port");
235+
logger.info("ready app is accessible thru ssl port forwarding");
236+
237+
stopPortForwardProcess(domainNamespace);
238+
245239

246240
Path archivePath = Paths.get(testWebAppWarLoc);
247241
String target = "{identity: [clusters,'" + clusterName + "']}";

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

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
import static oracle.weblogic.kubernetes.TestConstants.SKIP_CLEANUP;
5353
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TAG;
5454
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TO_USE_IN_SPEC;
55-
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_SLIM;
5655
import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR;
5756
import static oracle.weblogic.kubernetes.actions.TestActions.addLabelsToNamespace;
5857
import static oracle.weblogic.kubernetes.actions.TestActions.deletePersistentVolume;
@@ -165,8 +164,8 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
165164
* Deploy istio gateways and virtual service.
166165
* Verify domain pods runs in ready state and services are created.
167166
* Check WebLogic Server log for few Japanese characters.
168-
* Verify WebLogic console is accessible thru istio ingress http port
169-
* Verify WebLogic console is accessible thru kubectl forwarded port
167+
* Verify ready app is accessible thru istio ingress http port
168+
* Verify ready app is accessible thru kubectl forwarded port
170169
* Additionally, the test verifies that WebLogic cluster can be scaled down
171170
* and scaled up in the absence of Administration server.
172171
*/
@@ -329,26 +328,19 @@ void testIstioDomainHomeInPv() {
329328
// In internal OKE env, use Istio EXTERNAL-IP;
330329
// in non-internal-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort
331330
String hostAndPort = hostName.contains(K8S_NODEPORT_HOST) ? host + ":" + istioIngressPort : hostName;
332-
333-
// We can not verify Rest Management console thru Adminstration NodePort
334-
// in istio, as we can not enable Adminstration NodePort
335-
if (!WEBLOGIC_SLIM) {
336-
String consoleUrl = "http://" + hostAndPort + "/console/login/LoginForm.jsp";
337-
boolean checkConsole = checkAppUsingHostHeader(consoleUrl, domainNamespace + ".org");
338-
assertTrue(checkConsole, "Failed to access WebLogic console");
339-
logger.info("WebLogic console is accessible");
340-
String localhost = "localhost";
341-
String forwardPort = startPortForwardProcess(localhost, domainNamespace, domainUid, 7001);
342-
assertNotNull(forwardPort, "port-forward fails to assign local port");
343-
logger.info("Forwarded local port is {0}", forwardPort);
344-
consoleUrl = "http://" + localhost + ":" + forwardPort + "/console/login/LoginForm.jsp";
345-
checkConsole = checkAppUsingHostHeader(consoleUrl, domainNamespace + ".org");
346-
assertTrue(checkConsole, "Failed to access WebLogic console thru port-forwarded port");
347-
logger.info("WebLogic console is accessible thru port forwarding");
348-
stopPortForwardProcess(domainNamespace);
349-
} else {
350-
logger.info("Skipping WebLogic console in WebLogic slim image");
351-
}
331+
String readyAppUrl = "http://" + hostAndPort + "/weblogic/ready";
332+
boolean checlReadyApp = checkAppUsingHostHeader(readyAppUrl, domainNamespace + ".org");
333+
assertTrue(checlReadyApp, "Failed to access ready app");
334+
logger.info("ready app is accessible");
335+
String localhost = "localhost";
336+
String forwardPort = startPortForwardProcess(localhost, domainNamespace, domainUid, 7001);
337+
assertNotNull(forwardPort, "port-forward fails to assign local port");
338+
logger.info("Forwarded local port is {0}", forwardPort);
339+
readyAppUrl = "http://" + localhost + ":" + forwardPort + "/weblogic/ready";
340+
checlReadyApp = checkAppUsingHostHeader(readyAppUrl, domainNamespace + ".org");
341+
assertTrue(checlReadyApp, "Failed to access ready app thru port-forwarded port");
342+
logger.info("ready app is accessible thru port forwarding");
343+
stopPortForwardProcess(domainNamespace);
352344

353345
ExecResult result = null;
354346
if (isWebLogicPsuPatchApplied()) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ private static int configIstioGatewayModelInImageDomain(String miiImage,
287287
? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) : host + ":" + istioIngressPort;
288288

289289
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+
boolean checlReadyApp = checkAppUsingHostHeader(restUrl, domainNamespace + ".org");
291+
assertTrue(checlReadyApp, "Failed to access WebLogic REST interface");
292292

293293
Path archivePath = Paths.get(testWebAppWarLoc);
294294
String target = "{identity: [clusters,'" + clusterName + "']}";

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

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER_PRIVATEIP;
3030
import static oracle.weblogic.kubernetes.TestConstants.RESULTS_ROOT;
3131
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_REPO_SECRET_NAME;
32-
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_SLIM;
3332
import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR;
3433
import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR;
3534
import static oracle.weblogic.kubernetes.actions.TestActions.addLabelsToNamespace;
@@ -396,17 +395,11 @@ private void setupIstioModelInImageDomain(String miiImage, String domainNamespac
396395
String hostAndPort = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null
397396
? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) : host + ":" + istioIngressPort;
398397

399-
// We can not verify Rest Management console thru Adminstration NodePort
400-
// in istio, as we can not enable Adminstration NodePort
401-
if (!WEBLOGIC_SLIM) {
402-
String consoleUrl = "http://" + hostAndPort + "/console/login/LoginForm.jsp";
403-
boolean checkConsole =
404-
checkAppUsingHostHeader(consoleUrl, domainNamespace + ".org");
405-
assertTrue(checkConsole, "Failed to access WebLogic console");
406-
logger.info("WebLogic console is accessible");
407-
} else {
408-
logger.info("Skipping WebLogic console in WebLogic slim image");
409-
}
398+
String readyAppUrl = "http://" + host + ":" + istioIngressPort + "/weblogic/ready";
399+
boolean checlReadyApp =
400+
checkAppUsingHostHeader(readyAppUrl, domainNamespace + ".org");
401+
assertTrue(checlReadyApp, "Failed to access ready app");
402+
logger.info("ready app is accessible");
410403

411404
Path archivePath = Paths.get(testWebAppWarLoc);
412405
String target = "{identity: [clusters,'" + clusterName + "']}";
@@ -422,7 +415,6 @@ private void setupIstioModelInImageDomain(String miiImage, String domainNamespac
422415
logger.info("Application deployment returned {0}", result.toString());
423416
assertEquals("202", result.stdout(), "Deployment didn't return HTTP status code 202");
424417

425-
426418
String url = "http://" + hostAndPort + "/testwebapp/index.jsp";
427419
logger.info("Application Access URL {0}", url);
428420
}

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

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_REPO_SECRET_NAME;
3737
import static oracle.weblogic.kubernetes.TestConstants.WDT_BASIC_IMAGE_NAME;
3838
import static oracle.weblogic.kubernetes.TestConstants.WDT_BASIC_IMAGE_TAG;
39-
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_SLIM;
4039
import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR;
4140
import static oracle.weblogic.kubernetes.actions.TestActions.addLabelsToNamespace;
4241
import static oracle.weblogic.kubernetes.actions.TestActions.createDomainCustomResource;
@@ -280,17 +279,10 @@ void testIstioTwoDomainsWithSingleIngress() {
280279
String hostAndPort = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null
281280
? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) : host + ":" + istioIngressPort;
282281

283-
// We can not verify Rest Management console thru Adminstration NodePort
284-
// in istio, as we can not enable Adminstration NodePort
285-
286-
if (!WEBLOGIC_SLIM) {
287-
String consoleUrl = "http://" + hostAndPort + "/console/login/LoginForm.jsp";
288-
boolean checkConsole = checkAppUsingHostHeader(consoleUrl, domainNamespace1 + ".org");
289-
assertTrue(checkConsole, "Failed to access WebLogic console on domain1");
290-
logger.info("WebLogic console on domain1 is accessible");
291-
} else {
292-
logger.info("Skipping WebLogic console in WebLogic slim image");
293-
}
282+
String readyAppUrl = "http://" + hostAndPort + "/weblogic/ready";
283+
boolean checlReadyApp = checkAppUsingHostHeader(readyAppUrl, domainNamespace1 + ".org");
284+
assertTrue(checlReadyApp, "Failed to access ready app on domain1");
285+
logger.info("WebLogic console on domain1 is accessible");
294286

295287
Path archivePath = Paths.get(testWebAppWarLoc);
296288
String resourcePath = "/testwebapp/index.jsp";
@@ -326,16 +318,11 @@ void testIstioTwoDomainsWithSingleIngress() {
326318
}
327319
logger.info("Application {0} is accessble to {1}", resourcePath, domainUid1);
328320

329-
// We can not verify Rest Management console thru Adminstration NodePort
330-
// in istio, as we can not enable Adminstration NodePort
331-
if (!WEBLOGIC_SLIM) {
332-
String consoleUrl = "http://" + hostAndPort + "/console/login/LoginForm.jsp";
333-
boolean checkConsole = checkAppUsingHostHeader(consoleUrl, domainNamespace2 + ".org");
334-
assertTrue(checkConsole, "Failed to access domain2 WebLogic console");
335-
logger.info("WebLogic console on domain2 is accessible");
336-
} else {
337-
logger.info("Skipping WebLogic console in WebLogic slim image");
338-
}
321+
readyAppUrl = "http://" + hostAndPort + "/weblogic/ready";
322+
checlReadyApp = checkAppUsingHostHeader(readyAppUrl, domainNamespace2 + ".org");
323+
assertTrue(checlReadyApp, "Failed to access domain2 ready app");
324+
logger.info("ready app on domain2 is accessible");
325+
339326

340327
// In internal OKE env, deploy App in domain pods using WLST
341328
createBaseRepoSecret(domainNamespace2);

0 commit comments

Comments
 (0)