diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index cc807c31234..db6c75b7629 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -588,11 +588,10 @@ false - **/ItKubernetesEvents, + **/ItKubernetesDomainEvents, **/ItMiiAuxiliaryImage, **/ItMultiDomainModels, - **/ItPodsRestart, - **/ItTwoDomainsManagedByTwoOperators + **/ItPodsRestart diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiAuxiliaryImage.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiAuxiliaryImage.java index 7520ab2c06d..0eafb1ce732 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiAuxiliaryImage.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiAuxiliaryImage.java @@ -524,7 +524,7 @@ void testErrorPathDomainWithFailCustomMountCommand() { verifyIntrospectorPodLogContainsExpectedErrorMsg(domainUid, domainNamespace, expectedErrorMsg); // check the domain event contains the expected error message - checkDomainEventContainsExpectedMsg(opNamespace, domainNamespace, domainUid, DOMAIN_PROCESSING_FAILED, + checkDomainEventContainsExpectedMsg(domainNamespace, domainUid, DOMAIN_PROCESSING_FAILED, "Warning", timestamp, expectedErrorMsg); // check the operator pod log contains the expected error message @@ -622,7 +622,7 @@ void testErrorPathDomainMismatchMountPath() { verifyIntrospectorPodLogContainsExpectedErrorMsg(domainUid, errorpathDomainNamespace, expectedErrorMsg); // check the domain event contains the expected error message - checkDomainEventContainsExpectedMsg(opNamespace, errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED, + checkDomainEventContainsExpectedMsg(errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED, "Warning", timestamp, expectedErrorMsg); // check the operator pod log contains the expected error message @@ -707,7 +707,7 @@ void testErrorPathDomainMissingWDTBinary() { verifyIntrospectorPodLogContainsExpectedErrorMsg(domainUid, errorpathDomainNamespace, expectedErrorMsg); // check the domain event contains the expected error message - checkDomainEventContainsExpectedMsg(opNamespace, errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED, + checkDomainEventContainsExpectedMsg(errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED, "Warning", timestamp, expectedErrorMsg); // check the operator pod log contains the expected error message @@ -796,7 +796,7 @@ void testErrorPathDomainMissingDomainConfig() { verifyIntrospectorPodLogContainsExpectedErrorMsg(domainUid, errorpathDomainNamespace, expectedErrorMsg); // check the domain event contains the expected error message - checkDomainEventContainsExpectedMsg(opNamespace, errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED, + checkDomainEventContainsExpectedMsg(errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED, "Warning", timestamp, expectedErrorMsg); // check the operator pod log contains the expected error message @@ -904,7 +904,7 @@ void testErrorPathFilePermission() { verifyIntrospectorPodLogContainsExpectedErrorMsg(domainUid, errorpathDomainNamespace, expectedErrorMsg); // check the domain event contains the expected error message - checkDomainEventContainsExpectedMsg(opNamespace, errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED, + checkDomainEventContainsExpectedMsg(errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED, "Warning", timestamp, expectedErrorMsg); // check the operator pod log contains the expected error message diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiAuxiliaryImageCluster.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiAuxiliaryImageCluster.java index da1c9b76388..804c582fa05 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiAuxiliaryImageCluster.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiAuxiliaryImageCluster.java @@ -30,6 +30,8 @@ import static java.util.concurrent.TimeUnit.SECONDS; import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT; import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT; +import static oracle.weblogic.kubernetes.TestConstants.BUSYBOX_IMAGE; +import static oracle.weblogic.kubernetes.TestConstants.BUSYBOX_TAG; import static oracle.weblogic.kubernetes.TestConstants.DOMAIN_IMAGES_REPO; import static oracle.weblogic.kubernetes.TestConstants.MII_AUXILIARY_IMAGE_NAME; import static oracle.weblogic.kubernetes.TestConstants.MII_BASIC_IMAGE_TAG; @@ -38,6 +40,7 @@ import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TO_USE_IN_SPEC; import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR; import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR; +import static oracle.weblogic.kubernetes.actions.ActionConstants.WORK_DIR; import static oracle.weblogic.kubernetes.actions.TestActions.dockerPush; import static oracle.weblogic.kubernetes.actions.TestActions.getServiceNodePort; import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.createDomainResourceWithAuxiliaryImageClusterScope; @@ -45,6 +48,7 @@ import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.readFilesInPod; import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkSystemResourceConfiguration; import static oracle.weblogic.kubernetes.utils.DomainUtils.createDomainAndVerify; +import static oracle.weblogic.kubernetes.utils.FileUtils.replaceStringInFile; import static oracle.weblogic.kubernetes.utils.FileUtils.unzipWDTInstallationFile; import static oracle.weblogic.kubernetes.utils.ImageUtils.createOcirRepoSecret; import static oracle.weblogic.kubernetes.utils.OperatorUtils.installAndVerifyOperator; @@ -357,8 +361,18 @@ void testPatchDomainToAddModelsToClusterConfigIgnored() { } private void createAuxiliaryImage(String stageDirPath, String dockerFileLocation, String auxiliaryImage) { + //replace the BUSYBOX_IMAGE and BUSYBOX_TAG in Dockerfile + Path dockerDestFile = Paths.get(WORK_DIR, "auximages", "Dockerfile"); + assertDoesNotThrow(() -> { + Files.createDirectories(dockerDestFile.getParent()); + Files.copy(Paths.get(dockerFileLocation), + dockerDestFile, StandardCopyOption.REPLACE_EXISTING); + replaceStringInFile(dockerDestFile.toString(), "BUSYBOX_IMAGE", BUSYBOX_IMAGE); + replaceStringInFile(dockerDestFile.toString(), "BUSYBOX_TAG", BUSYBOX_TAG); + }); + String cmdToExecute = String.format("cd %s && docker build -f %s %s -t %s .", - stageDirPath, dockerFileLocation, + stageDirPath, dockerDestFile.toString(), "--build-arg AUXILIARY_IMAGE_PATH=" + auxiliaryImagePath, auxiliaryImage); assertTrue(new Command() .withParams(new CommandParams() diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiDynamicUpdatePart3.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiDynamicUpdatePart3.java index 7e7700955d6..40fd85d35a9 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiDynamicUpdatePart3.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiDynamicUpdatePart3.java @@ -182,7 +182,7 @@ void testMiiChangeListenPort() { checkPodLogContainsString(helper.opNamespace, operatorPodName, MII_DYNAMIC_UPDATE_EXPECTED_ERROR_MSG); // check the domain event contains the expected error message - checkDomainEventContainsExpectedMsg(helper.opNamespace, helper.domainNamespace, domainUid, DOMAIN_PROCESSING_FAILED, + checkDomainEventContainsExpectedMsg(helper.domainNamespace, domainUid, DOMAIN_PROCESSING_FAILED, "Warning", timestamp, MII_DYNAMIC_UPDATE_EXPECTED_ERROR_MSG); // clean failed introspector diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/K8sEvents.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/K8sEvents.java index 500a0b4dcc5..cc11a84e186 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/K8sEvents.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/K8sEvents.java @@ -28,7 +28,6 @@ import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; /** * Helper class for Kubernetes Events checking. @@ -429,7 +428,6 @@ public static Callable checkPodEventLoggedOnce( /** * Check the domain event contains the expected error msg. * - * @param opNamespace namespace in which the operator is running * @param domainNamespace namespace in which the domain exists * @param domainUid UID of the domain * @param reason event to check for Created, Changed, deleted, processing etc @@ -437,21 +435,21 @@ public static Callable checkPodEventLoggedOnce( * @param timestamp the timestamp after which to see events * @param expectedMsg the expected message in the domain event message */ - public static void checkDomainEventContainsExpectedMsg(String opNamespace, - String domainNamespace, + public static void checkDomainEventContainsExpectedMsg(String domainNamespace, String domainUid, String reason, String type, OffsetDateTime timestamp, String expectedMsg) { - checkEvent(opNamespace, domainNamespace, domainUid, reason, type, timestamp); - CoreV1Event event = getOpGeneratedEvent(domainNamespace, reason, type, timestamp); - if (event != null && event.getMessage() != null) { - assertTrue(event.getMessage().contains(expectedMsg), - String.format("The event message does not contain the expected msg %s", expectedMsg)); - } else { - fail("event is null or event message is null"); - } + withStandardRetryPolicy + .conditionEvaluationListener(condition -> + getLogger().info("Waiting for domain event {0} to be logged in namespace {1} " + + "(elapsed time {2}ms, remaining time {3}ms)", + reason, + domainNamespace, + condition.getElapsedTimeInMS(), + condition.getRemainingTimeInMS())) + .until(domainEventContainsExpectedMsg(domainNamespace, domainUid, reason, type, timestamp, expectedMsg)); } private static Callable domainEventContainsExpectedMsg(String domainNamespace,