Skip to content

Commit f835f62

Browse files
Fix testMiiRemoveTarget by not setting datahome on domain resource (#2307)
* fix changes in model Co-authored-by: Ryan Eberhard <[email protected]>
1 parent 5930d82 commit f835f62

File tree

4 files changed

+68
-56
lines changed

4 files changed

+68
-56
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
144144
createDomainResourceWithLogHome(domainUid, domainNamespace,
145145
MII_BASIC_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG,
146146
adminSecretName, OCIR_SECRET_NAME, encryptionSecretName,
147-
replicaCount, pvName, pvcName, "cluster-1", configMapName, null, false, false);
147+
replicaCount, pvName, pvcName, "cluster-1", configMapName,
148+
null, false, false, false);
148149

149150
// wait for the domain to exist
150151
logger.info("Check for domain custom resource in namespace {0}", domainNamespace);

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,14 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
203203
createJobToChangePermissionsOnPvHostPath(pvName, pvcName, domainNamespace);
204204

205205
// create the domain CR with a pre-defined configmap
206+
// setting setDataHome to false, testMiiRemoveTarget fails when data home is set at domain resource level
207+
// because of bug OWLS-88679
208+
// testMiiRemoveTarget should work fine after the bug is fixed with setDataHome set to true
206209
createDomainResourceWithLogHome(domainUid, domainNamespace,
207210
MII_BASIC_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG,
208211
adminSecretName, OCIR_SECRET_NAME, encryptionSecretName,
209-
replicaCount, pvName, pvcName, "cluster-1", configMapName, dbSecretName, false, true);
212+
replicaCount, pvName, pvcName, "cluster-1", configMapName,
213+
dbSecretName, false, true, false);
210214

211215
// wait for the domain to exist
212216
logger.info("Check for domain custom resource in namespace {0}", domainNamespace);
@@ -457,7 +461,7 @@ public void testMiiAddCluster() {
457461
}
458462

459463
// Replace contents of an existing configMap with cm config and application target as
460-
// there are issues with removing them, https://jira.oraclecorp.com/jira/browse/WDT-535
464+
// there are issues with removing them, WDT-535
461465
replaceConfigMapWithModelFiles(configMapName, domainUid, domainNamespace,
462466
Arrays.asList(MODEL_DIR + "/model.config.wm.yaml",
463467
pathToAddClusterYaml.toString()), withStandardRetryPolicy);
@@ -519,7 +523,7 @@ public void testMiiChangeDataSourceParameterWithCommitUpdateAndRoll() {
519523
LinkedHashMap<String, OffsetDateTime> pods = addDataSourceAndVerify(false);
520524

521525
// Replace contents of an existing configMap with cm config and application target as
522-
// there are issues with removing them, https://jira.oraclecorp.com/jira/browse/WDT-535
526+
// there are issues with removing them, WDT-535
523527
replaceConfigMapWithModelFiles(configMapName, domainUid, domainNamespace,
524528
Arrays.asList(MODEL_DIR + "/model.config.wm.yaml", pathToAddClusterYaml.toString(),
525529
MODEL_DIR + "/model.update.jdbc2.yaml"), withStandardRetryPolicy);
@@ -610,7 +614,7 @@ public void testMiiDeleteAppChangeDBUrlWithCommitUpdateAndRoll() {
610614
assertDoesNotThrow(() -> Files.write(pathToUndeployAppYaml, yamlToUndeployApp.getBytes()));
611615

612616
// Replace contents of an existing configMap with cm config and application target as
613-
// there are issues with removing them, https://jira.oraclecorp.com/jira/browse/WDT-535
617+
// there are issues with removing them, WDT-535
614618
replaceConfigMapWithModelFiles(configMapName, domainUid, domainNamespace,
615619
Arrays.asList(MODEL_DIR + "/model.config.wm.yaml", pathToAddClusterYaml.toString(),
616620
MODEL_DIR + "/model.jdbc2.update2.yaml", pathToUndeployAppYaml.toString()), withStandardRetryPolicy);
@@ -1499,7 +1503,7 @@ private LinkedHashMap<String, OffsetDateTime> addDataSourceAndVerify(boolean int
14991503
}
15001504

15011505
// Replace contents of an existing configMap with cm config and application target as
1502-
// there are issues with removing them, https://jira.oraclecorp.com/jira/browse/WDT-535
1506+
// there are issues with removing them, WDT-535
15031507
replaceConfigMapWithModelFiles(configMapName, domainUid, domainNamespace,
15041508
Arrays.asList(MODEL_DIR + "/model.config.wm.yaml", pathToAddClusterYaml.toString(),
15051509
MODEL_DIR + "/model.jdbc2.yaml"), withStandardRetryPolicy);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
186186
createDomainResourceWithLogHome(domainUid, domainNamespace,
187187
MII_BASIC_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG,
188188
adminSecretName, OCIR_SECRET_NAME, encryptionSecretName,
189-
replicaCount, pvName, pvcName, "cluster-1", configMapName, dbSecretName, false, false);
189+
replicaCount, pvName, pvcName, "cluster-1", configMapName,
190+
dbSecretName, false, false, true);
190191

191192
// wait for the domain to exist
192193
logger.info("Check for domain custom resource in namespace {0}", domainNamespace);

integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonMiiTestUtils.java

Lines changed: 55 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ public static Domain createDomainResource(
259259
* @param dbSecretName name of the Secret for WebLogic configuration overrides
260260
* @param allowReplicasBelowMinDynClusterSize whether to allow scaling below min dynamic cluster size
261261
* @param onlineUpdateEnabled whether to enable onlineUpdate feature for mii dynamic update
262+
* @param setDataHome whether to set data home at domain resource
262263
* @return domain object of the domain resource
263264
*/
264265
public static Domain createDomainResourceWithLogHome(
@@ -275,69 +276,74 @@ public static Domain createDomainResourceWithLogHome(
275276
String configMapName,
276277
String dbSecretName,
277278
boolean allowReplicasBelowMinDynClusterSize,
278-
boolean onlineUpdateEnabled) {
279+
boolean onlineUpdateEnabled,
280+
boolean setDataHome) {
279281
LoggingFacade logger = getLogger();
280282

281283
List<String> securityList = new ArrayList<>();
282284
if (dbSecretName != null) {
283285
securityList.add(dbSecretName);
284286
}
285287

288+
DomainSpec domainSpec = new DomainSpec()
289+
.domainUid(domainResourceName)
290+
.domainHomeSourceType("FromModel")
291+
.allowReplicasBelowMinDynClusterSize(allowReplicasBelowMinDynClusterSize)
292+
.image(imageName)
293+
.addImagePullSecretsItem(new V1LocalObjectReference()
294+
.name(repoSecretName))
295+
.webLogicCredentialsSecret(new V1SecretReference()
296+
.name(adminSecretName)
297+
.namespace(domNamespace))
298+
.includeServerOutInPodLog(true)
299+
.logHomeEnabled(Boolean.TRUE)
300+
.logHome("/shared/logs")
301+
.serverStartPolicy("IF_NEEDED")
302+
.serverPod(new ServerPod()
303+
.addEnvItem(new V1EnvVar()
304+
.name("JAVA_OPTIONS")
305+
.value("-Dweblogic.security.SSL.ignoreHostnameVerification=true"))
306+
.addEnvItem(new V1EnvVar()
307+
.name("USER_MEM_ARGS")
308+
.value("-Djava.security.egd=file:/dev/./urandom "))
309+
.addVolumesItem(new V1Volume()
310+
.name(pvName)
311+
.persistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource()
312+
.claimName(pvcName)))
313+
.addVolumeMountsItem(new V1VolumeMount()
314+
.mountPath("/shared")
315+
.name(pvName)))
316+
.adminServer(new AdminServer()
317+
.serverStartState("RUNNING")
318+
.adminService(new AdminService()
319+
.addChannelsItem(new Channel()
320+
.channelName("default")
321+
.nodePort(0))))
322+
.addClustersItem(new Cluster()
323+
.clusterName(clusterName)
324+
.replicas(replicaCount)
325+
.serverStartState("RUNNING"))
326+
.configuration(new Configuration()
327+
.secrets(securityList)
328+
.model(new Model()
329+
.domainType("WLS")
330+
.configMap(configMapName)
331+
.runtimeEncryptionSecret(encryptionSecretName)
332+
.onlineUpdate(new OnlineUpdate()
333+
.enabled(onlineUpdateEnabled)))
334+
.introspectorJobActiveDeadlineSeconds(300L));
335+
336+
if (setDataHome) {
337+
domainSpec.dataHome("/shared/data");
338+
}
286339
// create the domain CR
287340
Domain domain = new Domain()
288341
.apiVersion(DOMAIN_API_VERSION)
289342
.kind("Domain")
290343
.metadata(new V1ObjectMeta()
291344
.name(domainResourceName)
292345
.namespace(domNamespace))
293-
.spec(new DomainSpec()
294-
.domainUid(domainResourceName)
295-
.domainHomeSourceType("FromModel")
296-
.allowReplicasBelowMinDynClusterSize(allowReplicasBelowMinDynClusterSize)
297-
.image(imageName)
298-
.addImagePullSecretsItem(new V1LocalObjectReference()
299-
.name(repoSecretName))
300-
.webLogicCredentialsSecret(new V1SecretReference()
301-
.name(adminSecretName)
302-
.namespace(domNamespace))
303-
.includeServerOutInPodLog(true)
304-
.logHomeEnabled(Boolean.TRUE)
305-
.logHome("/shared/logs")
306-
.dataHome("/shared/data")
307-
.serverStartPolicy("IF_NEEDED")
308-
.serverPod(new ServerPod()
309-
.addEnvItem(new V1EnvVar()
310-
.name("JAVA_OPTIONS")
311-
.value("-Dweblogic.security.SSL.ignoreHostnameVerification=true"))
312-
.addEnvItem(new V1EnvVar()
313-
.name("USER_MEM_ARGS")
314-
.value("-Djava.security.egd=file:/dev/./urandom "))
315-
.addVolumesItem(new V1Volume()
316-
.name(pvName)
317-
.persistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource()
318-
.claimName(pvcName)))
319-
.addVolumeMountsItem(new V1VolumeMount()
320-
.mountPath("/shared")
321-
.name(pvName)))
322-
.adminServer(new AdminServer()
323-
.serverStartState("RUNNING")
324-
.adminService(new AdminService()
325-
.addChannelsItem(new Channel()
326-
.channelName("default")
327-
.nodePort(0))))
328-
.addClustersItem(new Cluster()
329-
.clusterName(clusterName)
330-
.replicas(replicaCount)
331-
.serverStartState("RUNNING"))
332-
.configuration(new Configuration()
333-
.secrets(securityList)
334-
.model(new Model()
335-
.domainType("WLS")
336-
.configMap(configMapName)
337-
.runtimeEncryptionSecret(encryptionSecretName)
338-
.onlineUpdate(new OnlineUpdate()
339-
.enabled(onlineUpdateEnabled)))
340-
.introspectorJobActiveDeadlineSeconds(300L)));
346+
.spec(domainSpec);
341347

342348
logger.info("Create domain custom resource for domainUid {0} in namespace {1}",
343349
domainResourceName, domNamespace);

0 commit comments

Comments
 (0)