From d5da6d8b393e84e498866fde21ec71f88e9dad51 Mon Sep 17 00:00:00 2001 From: huiling_zhao Date: Thu, 8 Aug 2024 20:40:13 +0000 Subject: [PATCH] Forward port the changes in JIRA OWLS-118501 to main --- .../kubernetes/ItFmwDomainOnPVSample.java | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItFmwDomainOnPVSample.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItFmwDomainOnPVSample.java index 4ffc5e3b4e1..901bfd8bd8e 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItFmwDomainOnPVSample.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItFmwDomainOnPVSample.java @@ -1,4 +1,4 @@ -// 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; @@ -6,6 +6,7 @@ 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; @@ -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. @@ -248,7 +250,12 @@ 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"); + } /** @@ -256,8 +263,8 @@ public void testInitialMain() { * @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; @@ -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 checkTestScriptAndAssertSuccess(String arg, String errString) { + return () -> execTestScriptAndAssertSuccess(arg, errString); } /**