1
- // Copyright (c) 2021, 2023 , 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 ;
36
36
import static oracle .weblogic .kubernetes .TestConstants .ADMIN_PASSWORD_DEFAULT ;
37
37
import static oracle .weblogic .kubernetes .TestConstants .ADMIN_USERNAME_DEFAULT ;
38
38
import static oracle .weblogic .kubernetes .TestConstants .BASE_IMAGES_REPO_SECRET_NAME ;
39
- import static oracle .weblogic .kubernetes .TestConstants .DB_IMAGE_TO_USE_IN_SPEC ;
40
39
import static oracle .weblogic .kubernetes .TestConstants .DOMAIN_API_VERSION ;
41
40
import static oracle .weblogic .kubernetes .TestConstants .FMWINFRA_IMAGE_TO_USE_IN_SPEC ;
42
41
import static oracle .weblogic .kubernetes .TestConstants .IMAGE_PULL_POLICY ;
43
42
import static oracle .weblogic .kubernetes .TestConstants .K8S_NODEPORT_HOST ;
44
43
import static oracle .weblogic .kubernetes .actions .ActionConstants .RESOURCE_DIR ;
45
44
import static oracle .weblogic .kubernetes .actions .impl .primitive .Image .getImageEnvVar ;
45
+ import static oracle .weblogic .kubernetes .utils .CommonTestUtils .createIngressHostRouting ;
46
46
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getNextFreePort ;
47
47
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getUniqueName ;
48
48
import static oracle .weblogic .kubernetes .utils .ConfigMapUtils .createConfigMapForDomainCreation ;
49
+ import static oracle .weblogic .kubernetes .utils .DbUtils .createOracleDBUsingOperator ;
50
+ import static oracle .weblogic .kubernetes .utils .DbUtils .createRcuSchema ;
49
51
import static oracle .weblogic .kubernetes .utils .DbUtils .createRcuSecretWithUsernamePassword ;
50
- import static oracle .weblogic .kubernetes .utils .DbUtils .setupDBandRCUschema ;
52
+ import static oracle .weblogic .kubernetes .utils .DbUtils .installDBOperator ;
51
53
import static oracle .weblogic .kubernetes .utils .DomainUtils .createDomainAndVerify ;
52
54
import static oracle .weblogic .kubernetes .utils .FmwUtils .verifyDomainReady ;
53
55
import static oracle .weblogic .kubernetes .utils .FmwUtils .verifyEMconsoleAccess ;
@@ -102,6 +104,9 @@ class ItFmwDynamicDomainInPV {
102
104
private final String rcuSecretName = domainUid + "-rcu-credentials" ;
103
105
private static final int replicaCount = 1 ;
104
106
private String adminSvcExtHost = null ;
107
+ private static String hostHeader ;
108
+ private static int adminPort = 7001 ;
109
+ private static String dbName = domainUid + "my-oracle-db" ;
105
110
106
111
/**
107
112
* Assigns unique namespaces for DB, operator and domains.
@@ -115,9 +120,6 @@ public static void initAll(@Namespaces(3) List<String> namespaces) {
115
120
logger .info ("Assign a unique namespace for DB and RCU" );
116
121
assertNotNull (namespaces .get (0 ), "Namespace is null" );
117
122
dbNamespace = namespaces .get (0 );
118
- final int dbListenerPort = getNextFreePort ();
119
- ORACLEDBSUFFIX = ".svc.cluster.local:" + dbListenerPort + "/devpdb.k8s" ;
120
- dbUrl = ORACLEDBURLPREFIX + dbNamespace + ORACLEDBSUFFIX ;
121
123
122
124
logger .info ("Assign a unique namespace for operator1" );
123
125
assertNotNull (namespaces .get (1 ), "Namespace is null" );
@@ -127,16 +129,17 @@ public static void initAll(@Namespaces(3) List<String> namespaces) {
127
129
assertNotNull (namespaces .get (2 ), "Namespace is null" );
128
130
domainNamespace = namespaces .get (2 );
129
131
130
- logger .info ("Start DB and create RCU schema for namespace: {0}, dbListenerPort: {1}, RCU prefix: {2}, "
131
- + "dbUrl: {3}, dbImage: {4}, fmwImage: {5} " , dbNamespace , dbListenerPort , RCUSCHEMAPREFIX , dbUrl ,
132
- DB_IMAGE_TO_USE_IN_SPEC , FMWINFRA_IMAGE_TO_USE_IN_SPEC );
133
- assertDoesNotThrow (() -> setupDBandRCUschema (DB_IMAGE_TO_USE_IN_SPEC , FMWINFRA_IMAGE_TO_USE_IN_SPEC ,
134
- RCUSCHEMAPREFIX , dbNamespace , getNextFreePort (), dbUrl , dbListenerPort ),
135
- String .format ("Failed to create RCU schema for prefix %s in the namespace %s with "
136
- + "dbUrl %s, dbListenerPost %s" , RCUSCHEMAPREFIX , dbNamespace , dbUrl , dbListenerPort ));
132
+ //install Oracle Database Operator
133
+ assertDoesNotThrow (() -> installDBOperator (dbNamespace ), "Failed to install database operator" );
134
+
135
+ logger .info ("Create Oracle DB in namespace: {0} " , dbNamespace );
136
+ dbUrl = assertDoesNotThrow (() -> createOracleDBUsingOperator (dbName , RCUSYSPASSWORD , dbNamespace ));
137
+
138
+ logger .info ("Create RCU schema with fmwImage: {0}, rcuSchemaPrefix: {1}, dbUrl: {2}, "
139
+ + " dbNamespace: {3}" , FMWINFRA_IMAGE_TO_USE_IN_SPEC , RCUSCHEMAPREFIX , dbUrl , dbNamespace );
140
+ assertDoesNotThrow (() -> createRcuSchema (FMWINFRA_IMAGE_TO_USE_IN_SPEC , RCUSCHEMAPREFIX ,
141
+ dbUrl , dbNamespace ));
137
142
138
- logger .info ("DB image: {0}, FMW image {1} used in the test" ,
139
- DB_IMAGE_TO_USE_IN_SPEC , FMWINFRA_IMAGE_TO_USE_IN_SPEC );
140
143
141
144
// install operator and verify its running in ready state
142
145
installAndVerifyOperator (opNamespace , domainNamespace );
@@ -155,7 +158,13 @@ void testFmwDynamicDomainInPV() {
155
158
verifyDomainReady (domainNamespace , domainUid , replicaCount , "nosuffix" );
156
159
// Expose the admin service external node port as a route for OKD
157
160
adminSvcExtHost = createRouteForOKD (getExternalServicePodName (adminServerPodName ), domainNamespace );
158
- verifyEMconsoleAccess (domainNamespace , domainUid , adminSvcExtHost );
161
+ if (TestConstants .KIND_CLUSTER
162
+ && !TestConstants .WLSIMG_BUILDER .equals (TestConstants .WLSIMG_BUILDER_DEFAULT )) {
163
+ hostHeader = createIngressHostRouting (domainNamespace , domainUid , adminServerName , adminPort );
164
+ verifyEMconsoleAccess (domainNamespace , domainUid , adminSvcExtHost , hostHeader );
165
+ } else {
166
+ verifyEMconsoleAccess (domainNamespace , domainUid , adminSvcExtHost );
167
+ }
159
168
}
160
169
161
170
private void createFmwDomainAndVerify () {
0 commit comments