Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,10 @@
<properties>
<skipITs>false</skipITs>
<includes-failsafe>
**/ItKubernetesEvents,
**/ItKubernetesDomainEvents,
**/ItMiiAuxiliaryImage,
**/ItMultiDomainModels,
**/ItPodsRestart,
**/ItTwoDomainsManagedByTwoOperators
**/ItPodsRestart
</includes-failsafe>
</properties>
</profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,13 +40,15 @@
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;
import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.patchDomainClusterWithAuxImageAndVerify;
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;
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -429,29 +428,28 @@ public static Callable<Boolean> 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
* @param type type of event, Normal of Warning
* @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<Boolean> domainEventContainsExpectedMsg(String domainNamespace,
Expand Down