Skip to content

Commit 93fd4b7

Browse files
maggiehe00rjeberhard
authored andcommitted
Create JRF domain when the provided OPSS wallet does not exist
1 parent 139881d commit 93fd4b7

File tree

2 files changed

+116
-8
lines changed

2 files changed

+116
-8
lines changed

Jenkinsfile.kindnightly

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ EOF
570570
export TEST_IMAGES_REPO_USERNAME="${OCIR_USER}"
571571
export TEST_IMAGES_REPO_PASSWORD="${OCIR_PASS}"
572572
export TEST_IMAGES_REPO_EMAIL="[email protected]"
573-
if [ -n "${IT_TEST}" ]; then
573+
if [ "${IT_TEST}" != "**/It*" ]; then
574574
echo 'Overriding MAVEN_PROFILE_NAME to integration-test when running individual test(s)'
575575
export MAVEN_PROFILE_NAME="integration-tests"
576576
fi

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

Lines changed: 115 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@
4242
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_REPO_SECRET_NAME;
4343
import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR;
4444
import static oracle.weblogic.kubernetes.actions.TestActions.deletePod;
45+
import static oracle.weblogic.kubernetes.actions.TestActions.getOperatorPodName;
4546
import static oracle.weblogic.kubernetes.utils.AuxiliaryImageUtils.createAndPushAuxiliaryImage;
4647
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.addSccToDBSvcAccount;
4748
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getNextFreePort;
4849
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getUniqueName;
50+
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.testUntil;
4951
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.verifyConfiguredSystemResource;
5052
import static oracle.weblogic.kubernetes.utils.ConfigMapUtils.createConfigMapAndVerify;
5153
import static oracle.weblogic.kubernetes.utils.DbUtils.createRcuAccessSecret;
@@ -61,6 +63,7 @@
6163
import static oracle.weblogic.kubernetes.utils.OKDUtils.createRouteForOKD;
6264
import static oracle.weblogic.kubernetes.utils.OperatorUtils.installAndVerifyOperator;
6365
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodDoesNotExist;
66+
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodLogContains;
6467
import static oracle.weblogic.kubernetes.utils.PodUtils.getExternalServicePodName;
6568
import static oracle.weblogic.kubernetes.utils.SecretUtils.createOpsswalletpasswordSecret;
6669
import static oracle.weblogic.kubernetes.utils.SecretUtils.createSecretWithUsernamePassword;
@@ -224,7 +227,6 @@ void testFmwDomainOnPvUserCreatesRCU() {
224227
opsswalletpassSecretName1, null,
225228
pvName, pvcName, Collections.singletonList(domainCreationImage1), null);
226229

227-
// create a domain custom resource and verify domain is created
228230
createDomainAndVerify(domain, domainNamespace);
229231

230232
// verify that all servers are ready
@@ -259,7 +261,7 @@ void testFmwDomainOnPvUserProvideOpss() {
259261
rcuaccessSecretName1,
260262
opsswalletpassSecretName1, opsswalletfileSecretName1,
261263
pvName, pvcName, Collections.singletonList(domainCreationImage1), null);
262-
// create a domain custom resource and verify domain is created
264+
263265
createDomainAndVerify(domain, domainNamespace);
264266

265267
// verify that all servers are ready and EM console is accessible
@@ -274,12 +276,108 @@ void testFmwDomainOnPvUserProvideOpss() {
274276

275277
}
276278

279+
/**
280+
* The user provides opss.walletFileSecret that does not exist.
281+
* In this case the domain will not be created and operator will log message like
282+
* "Domain xxx is not valid: OpssWalletFile secret 'xxx' not found in namespace xxx"
283+
*/
284+
@Test
285+
@Order(3)
286+
@DisplayName("Create a FMW domain on PV when user provide OPSS wallet file secret that does not exist")
287+
void testFmwDomainOnPvUserProvideOpssNotexist() {
288+
String domainUid = "jrfdomainonpv-userrcu2";
289+
String adminSecretName = domainUid + "-weblogic-credentials";
290+
String rcuaccessSecretName = domainUid + "-rcu-credentials";
291+
String opsswalletpassSecretName = domainUid + "-opss-wallet-password-secret";
292+
String opsswalletfileSecretName = domainUid + "-opss-wallet-file-secret";
293+
final String pvName = getUniqueName(domainUid1 + "-pv-");
294+
final String pvcName = getUniqueName(domainUid1 + "-pvc-");
295+
296+
//create RCU schema
297+
assertDoesNotThrow(() -> createRcuSchema(FMWINFRA_IMAGE_TO_USE_IN_SPEC, RCUSCHEMAPREFIX + "2",
298+
dbUrl, dbNamespace),"create RCU schema failed");
299+
300+
// create a model property file
301+
File fmwModelPropFile = createWdtPropertyFile(domainUid, RCUSCHEMAPREFIX + "2");
302+
303+
// Create the repo secret to pull the image
304+
// this secret is used only for non-kind cluster
305+
createTestRepoSecret(domainNamespace);
306+
307+
// create secret for admin credentials
308+
logger.info("Create secret for admin credentials");
309+
assertDoesNotThrow(() -> createSecretWithUsernamePassword(
310+
adminSecretName,
311+
domainNamespace,
312+
ADMIN_USERNAME_DEFAULT,
313+
ADMIN_PASSWORD_DEFAULT),
314+
String.format("createSecret failed for %s", adminSecretName));
315+
316+
// create RCU access secret
317+
logger.info("Creating RCU access secret: {0}, with prefix: {1}, dbUrl: {2}, schemapassword: {3})",
318+
rcuaccessSecretName, RCUSCHEMAPREFIX + "2", RCUSCHEMAPASSWORD, dbUrl);
319+
assertDoesNotThrow(() -> createRcuAccessSecret(
320+
rcuaccessSecretName,
321+
domainNamespace,
322+
RCUSCHEMAPREFIX + "2",
323+
RCUSCHEMAPASSWORD,
324+
dbUrl),
325+
String.format("createSecret failed for %s", rcuaccessSecretName));
326+
327+
logger.info("Create OPSS wallet password secret");
328+
assertDoesNotThrow(() -> createOpsswalletpasswordSecret(
329+
opsswalletpassSecretName,
330+
domainNamespace,
331+
ADMIN_PASSWORD_DEFAULT),
332+
String.format("createSecret failed for %s", opsswalletpassSecretName));
333+
334+
List<String> modelList = new ArrayList<>();
335+
modelList.add(MODEL_DIR + "/" + fmwModelFile);
336+
List<String> modelProList = new ArrayList<>();
337+
modelProList.add(fmwModelPropFile.toPath().toString());
338+
String miiAuxiliaryImageTag = "jrf2" + MII_BASIC_IMAGE_TAG;
339+
WitParams witParams =
340+
new WitParams()
341+
.modelImageName(MII_AUXILIARY_IMAGE_NAME)
342+
.modelImageTag(miiAuxiliaryImageTag)
343+
.modelFiles(modelList)
344+
.modelVariableFiles(modelProList);
345+
createAndPushAuxiliaryImage(MII_AUXILIARY_IMAGE_NAME, miiAuxiliaryImageTag, witParams);
346+
DomainCreationImage domainCreationImage =
347+
new DomainCreationImage().image(MII_AUXILIARY_IMAGE_NAME + ":" + miiAuxiliaryImageTag);
348+
349+
// create a domain custom resource configuration object
350+
logger.info("Creating domain custom resource with pvName: {0}", pvName);
351+
DomainResource domain = createDomainResourceSimplifyJrfPv(
352+
domainUid, domainNamespace, adminSecretName,
353+
TEST_IMAGES_REPO_SECRET_NAME,
354+
rcuaccessSecretName,
355+
opsswalletpassSecretName, opsswalletfileSecretName,
356+
pvName, pvcName, Collections.singletonList(domainCreationImage), null);
357+
358+
createDomainAndVerify(domain, domainNamespace);
359+
360+
String expectedErrorMsg = String.format("Domain %s is not valid: OpssWalletFile secret '%s'"
361+
+ " not found in namespace '%s'", domainUid, opsswalletfileSecretName, domainNamespace);
362+
String operatorPodName =
363+
assertDoesNotThrow(() -> getOperatorPodName(OPERATOR_RELEASE_NAME, opNamespace));
364+
verifyPodWithExpectedErrorMsg(expectedErrorMsg, operatorPodName, opNamespace);
365+
366+
// delete the domain
367+
deleteDomainResource(domainNamespace, domainUid);
368+
//delete the rcu pod
369+
assertDoesNotThrow(() -> deletePod("rcu", dbNamespace),
370+
"Got exception while deleting server " + "rcu");
371+
checkPodDoesNotExist("rcu", null, dbNamespace);
372+
373+
}
374+
277375
/**
278376
* User creates RCU, Operate creates PV/PVC and FMW domain with multiple images
279377
* Verify Pod is ready and service exists for both admin server and managed servers.
280378
*/
281379
@Test
282-
@Order(3)
380+
@Order(4)
283381
@DisplayName("Create a FMW domain on PV with multiple images when user per-creates RCU")
284382
void testFmwDomainOnPvUserCreatesRCUMultiImages() {
285383
String domainUid = "jrfdomainonpv-userrcu3";
@@ -356,7 +454,6 @@ void testFmwDomainOnPvUserCreatesRCUMultiImages() {
356454
opsswalletpassSecretName, null,
357455
pvName, pvcName, domainCreationImages, null);
358456

359-
// create a domain custom resource and verify domain is created
360457
createDomainAndVerify(domain, domainNamespace);
361458

362459
// verify that all servers are ready
@@ -385,8 +482,8 @@ void testFmwDomainOnPvUserCreatesRCUMultiImages() {
385482
* Verify Pod is ready and service exists for both admin server and managed servers.
386483
*/
387484
@Test
388-
@Order(4)
389-
@DisplayName("Create a FMW domain on PV with multiple images when user per-creates RCU")
485+
@Order(5)
486+
@DisplayName("Create a FMW domain on PV with additional WDT config map when user per-creates RCU")
390487
void testFmwDomainOnPvUserCreatesRCUwdtConfigMap() {
391488
String domainUid = "jrfdomainonpv-userrcu4";
392489
String adminSecretName = domainUid + "-weblogic-credentials";
@@ -452,7 +549,6 @@ void testFmwDomainOnPvUserCreatesRCUwdtConfigMap() {
452549
opsswalletpassSecretName, null,
453550
pvName, pvcName, domainCreationImages, configMapName);
454551

455-
// create a domain custom resource and verify domain is created
456552
createDomainAndVerify(domain, domainNamespace);
457553

458554
// verify that all servers are ready
@@ -553,5 +649,17 @@ private static void checkConfiguredJMSresouce(String domainNamespace, String adm
553649
verifyConfiguredSystemResource(domainNamespace, adminServerPodName, adminSvcExtHost,
554650
"JMSSystemResources", "TestClusterJmsModule2", "200");
555651
}
652+
653+
private void verifyPodWithExpectedErrorMsg(String expectedErrorMsg, String podName, String nameSpace) {
654+
655+
logger.info("Verifying operator pod log for error messages");
656+
testUntil(
657+
() -> assertDoesNotThrow(() -> checkPodLogContains(expectedErrorMsg, podName, nameSpace),
658+
String.format("Checking operator pod %s log failed for namespace %s, expectErrorMsg %s", podName,
659+
nameSpace, expectedErrorMsg)),
660+
logger,
661+
"Checking operator log containing the expected error msg {0}:",
662+
expectedErrorMsg);
663+
}
556664

557665
}

0 commit comments

Comments
 (0)