1
- // Copyright (c) 2021, 2022 , Oracle and/or its affiliates.
1
+ // Copyright (c) 2021, 2024 , Oracle and/or its affiliates.
2
2
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3
3
4
4
package oracle .weblogic .kubernetes ;
43
43
import static oracle .weblogic .kubernetes .TestConstants .MII_BASIC_IMAGE_TAG ;
44
44
import static oracle .weblogic .kubernetes .TestConstants .SKIP_CLEANUP ;
45
45
import static oracle .weblogic .kubernetes .TestConstants .TEST_IMAGES_REPO_SECRET_NAME ;
46
+ import static oracle .weblogic .kubernetes .TestConstants .TRAEFIK_INGRESS_HTTP_HOSTPORT ;
46
47
import static oracle .weblogic .kubernetes .actions .ActionConstants .ITTESTS_DIR ;
47
48
import static oracle .weblogic .kubernetes .actions .ActionConstants .MODEL_DIR ;
48
49
import static oracle .weblogic .kubernetes .actions .ActionConstants .RESOURCE_DIR ;
61
62
import static oracle .weblogic .kubernetes .utils .CommonMiiTestUtils .createDomainSecret ;
62
63
import static oracle .weblogic .kubernetes .utils .CommonMiiTestUtils .createJobToChangePermissionsOnPvHostPath ;
63
64
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .checkPodReadyAndServiceExists ;
65
+ import static oracle .weblogic .kubernetes .utils .CommonTestUtils .createIngressHostRouting ;
64
66
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getHostAndPort ;
65
67
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getUniqueName ;
66
68
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .runClientInsidePod ;
@@ -126,6 +128,8 @@ class ItDBOperator {
126
128
private static LoggingFacade logger = null ;
127
129
128
130
private String fmwDomainUid = "fmwdomain-mii-db" ;
131
+ private String adminServerName = "admin-server" ;
132
+ private static int adminPort = 7001 ;
129
133
private String fmwAdminServerPodName = fmwDomainUid + "-admin-server" ;
130
134
private String fmwManagedServerPrefix = fmwDomainUid + "-managed-server" ;
131
135
private int replicaCount = 2 ;
@@ -149,6 +153,8 @@ class ItDBOperator {
149
153
private final Path domainLifecycleSamplePath = Paths .get (samplePath + "/scripts/domain-lifecycle" );
150
154
private final String fmwClusterResName = fmwDomainUid + "-" + clusterName ;
151
155
private final String wlsClusterResName = wlsDomainUid + "-" + clusterName ;
156
+
157
+ private static String hostHeader ;
152
158
153
159
/**
154
160
* Start DB service and create RCU schema.
@@ -280,7 +286,14 @@ void testFmwModelInImageWithDbOperator() {
280
286
verifyDomainReady (fmwDomainNamespace , fmwDomainUid , replicaCount );
281
287
// Expose the admin service external node port as a route for OKD
282
288
adminSvcExtHost = createRouteForOKD (getExternalServicePodName (fmwAdminServerPodName ), fmwDomainNamespace );
283
- verifyEMconsoleAccess (fmwDomainNamespace , fmwDomainUid , adminSvcExtHost );
289
+
290
+ if (TestConstants .KIND_CLUSTER
291
+ && !TestConstants .WLSIMG_BUILDER .equals (TestConstants .WLSIMG_BUILDER_DEFAULT )) {
292
+ hostHeader = createIngressHostRouting (fmwDomainNamespace , fmwDomainUid , adminServerName , adminPort );
293
+ verifyEMconsoleAccess (fmwDomainNamespace , fmwDomainUid , adminSvcExtHost , hostHeader );
294
+ } else {
295
+ verifyEMconsoleAccess (fmwDomainNamespace , fmwDomainUid , adminSvcExtHost );
296
+ }
284
297
285
298
//Reuse the same RCU schema to restart JRF domain
286
299
testReuseRCUschemaToRestartDomain ();
@@ -374,6 +387,10 @@ void testWlsModelInImageWithDbOperator() {
374
387
checkPodReadyAndServiceExists (wlsManagedServerPrefix + i , wlsDomainUid , wlsDomainNamespace );
375
388
}
376
389
390
+ if (TestConstants .KIND_CLUSTER
391
+ && !TestConstants .WLSIMG_BUILDER .equals (TestConstants .WLSIMG_BUILDER_DEFAULT )) {
392
+ hostHeader = createIngressHostRouting (wlsDomainNamespace , wlsDomainUid , adminServerName , adminPort );
393
+ }
377
394
//Verify JMS/JTA Service migration with File(JDBC) Store
378
395
testMiiJmsJtaServiceMigration ();
379
396
}
@@ -547,6 +564,11 @@ private boolean checkJmsServerRuntime(String jmsServer, String managedServer) {
547
564
String hostAndPort = getHostAndPort (adminSvcExtRouteHost , adminServiceNodePort );
548
565
StringBuffer curlString = new StringBuffer ("status=$(curl --user "
549
566
+ ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT + " " );
567
+ if (TestConstants .KIND_CLUSTER
568
+ && !TestConstants .WLSIMG_BUILDER .equals (TestConstants .WLSIMG_BUILDER_DEFAULT )) {
569
+ hostAndPort = "localhost:" + TRAEFIK_INGRESS_HTTP_HOSTPORT ;
570
+ curlString .append (" -H 'host: " + hostHeader + "' " );
571
+ }
550
572
curlString .append ("http://" + hostAndPort )
551
573
.append ("/management/weblogic/latest/domainRuntime/serverRuntimes/" )
552
574
.append (managedServer )
@@ -578,6 +600,11 @@ private boolean checkStoreRuntime(String storeName, String managedServer) {
578
600
String hostAndPort = getHostAndPort (adminSvcExtRouteHost , adminServiceNodePort );
579
601
StringBuffer curlString = new StringBuffer ("status=$(curl --user "
580
602
+ ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT + " " );
603
+ if (TestConstants .KIND_CLUSTER
604
+ && !TestConstants .WLSIMG_BUILDER .equals (TestConstants .WLSIMG_BUILDER_DEFAULT )) {
605
+ hostAndPort = "localhost:" + TRAEFIK_INGRESS_HTTP_HOSTPORT ;
606
+ curlString .append (" -H 'host: " + hostHeader + "' " );
607
+ }
581
608
curlString .append ("http://" + hostAndPort )
582
609
.append ("/management/weblogic/latest/domainRuntime/serverRuntimes/" )
583
610
.append (managedServer )
@@ -611,6 +638,11 @@ private boolean checkJtaRecoveryServiceRuntime(String managedServer, String reco
611
638
String hostAndPort = getHostAndPort (adminSvcExtRouteHost , adminServiceNodePort );
612
639
StringBuffer curlString = new StringBuffer ("curl --user "
613
640
+ ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT + " " );
641
+ if (TestConstants .KIND_CLUSTER
642
+ && !TestConstants .WLSIMG_BUILDER .equals (TestConstants .WLSIMG_BUILDER_DEFAULT )) {
643
+ hostAndPort = "localhost:" + TRAEFIK_INGRESS_HTTP_HOSTPORT ;
644
+ curlString .append (" -H 'host: " + hostHeader + "' " );
645
+ }
614
646
curlString .append ("\" http://" + hostAndPort )
615
647
.append ("/management/weblogic/latest/domainRuntime/serverRuntimes/" )
616
648
.append (managedServer )
0 commit comments