Skip to content

Commit

Permalink
Merge branch 'fmwdomainonpvsample-fix-main' into 'main'
Browse files Browse the repository at this point in the history
Forward port the changes in JIRA OWLS-118501 to main

See merge request weblogic-cloud/weblogic-kubernetes-operator!4769
  • Loading branch information
rjeberhard committed Aug 8, 2024
2 parents 6187b48 + d5da6d8 commit 69f3cfb
Showing 1 changed file with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Copyright (c) 2023, Oracle and/or its affiliates.
// Copyright (c) 2023, 2024, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.

package oracle.weblogic.kubernetes;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;

import oracle.weblogic.kubernetes.actions.impl.UniqueName;
import oracle.weblogic.kubernetes.actions.impl.primitive.Command;
Expand Down Expand Up @@ -54,12 +55,13 @@
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.backupReports;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getUniqueName;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.restoreReports;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.testUntil;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.withLongRetryPolicy;
import static oracle.weblogic.kubernetes.utils.ImageUtils.createBaseRepoSecret;
import static oracle.weblogic.kubernetes.utils.ImageUtils.createTestRepoSecret;
import static oracle.weblogic.kubernetes.utils.SampleUtils.createPVHostPathAndChangePermissionInKindCluster;
import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* Test and verify Domain on PV FMW domain sample.
Expand Down Expand Up @@ -248,16 +250,21 @@ public void testInitialMain() {
createPVHostPathAndChangePermissionInKindCluster("/shared", envMap);
}

execTestScriptAndAssertSuccess("-initial-main", "Failed to run -initial-main");
testUntil(
withLongRetryPolicy,
checkTestScriptAndAssertSuccess("-initial-main", "Failed to run -initial-main"),
logger,
"create PV HostPath and change Permission in Kind Cluster");

}

/**
* Run script run-test.sh.
* @param arg arguments to execute script
* @param errString a string of detailed error
*/
private void execTestScriptAndAssertSuccess(String arg,
String errString) {
private boolean execTestScriptAndAssertSuccess(String arg,
String errString) {

Assumptions.assumeTrue(previousTestSuccessful);
previousTestSuccessful = false;
Expand All @@ -284,9 +291,15 @@ private void execTestScriptAndAssertSuccess(String arg,
outStr += ", stderr=\n{\n" + (result != null ? result.stderr() : "") + "\n}\n";
outStr += ", stdout=\n{\n" + (result != null ? result.stdout() : "") + "\n}\n";

assertTrue(success, outStr);
logger.info("output String is: {0}", outStr);

previousTestSuccessful = true;

return success;
}

private Callable<Boolean> checkTestScriptAndAssertSuccess(String arg, String errString) {
return () -> execTestScriptAndAssertSuccess(arg, errString);
}

/**
Expand Down

0 comments on commit 69f3cfb

Please sign in to comment.