Skip to content

Commit 92268f9

Browse files
authored
backport triage ItMiiAuxiliaryImage test failure in release/3.4 (#3022)
* backport triage ItMiiAuxiliaryImage test failure in release/3.4
1 parent fc2d771 commit 92268f9

File tree

5 files changed

+33
-22
lines changed

5 files changed

+33
-22
lines changed

integration-tests/pom.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,11 +588,10 @@
588588
<properties>
589589
<skipITs>false</skipITs>
590590
<includes-failsafe>
591-
**/ItKubernetesEvents,
591+
**/ItKubernetesDomainEvents,
592592
**/ItMiiAuxiliaryImage,
593593
**/ItMultiDomainModels,
594-
**/ItPodsRestart,
595-
**/ItTwoDomainsManagedByTwoOperators
594+
**/ItPodsRestart
596595
</includes-failsafe>
597596
</properties>
598597
</profile>

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ void testErrorPathDomainWithFailCustomMountCommand() {
524524
verifyIntrospectorPodLogContainsExpectedErrorMsg(domainUid, domainNamespace, expectedErrorMsg);
525525

526526
// check the domain event contains the expected error message
527-
checkDomainEventContainsExpectedMsg(opNamespace, domainNamespace, domainUid, DOMAIN_PROCESSING_FAILED,
527+
checkDomainEventContainsExpectedMsg(domainNamespace, domainUid, DOMAIN_PROCESSING_FAILED,
528528
"Warning", timestamp, expectedErrorMsg);
529529

530530
// check the operator pod log contains the expected error message
@@ -622,7 +622,7 @@ void testErrorPathDomainMismatchMountPath() {
622622
verifyIntrospectorPodLogContainsExpectedErrorMsg(domainUid, errorpathDomainNamespace, expectedErrorMsg);
623623

624624
// check the domain event contains the expected error message
625-
checkDomainEventContainsExpectedMsg(opNamespace, errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED,
625+
checkDomainEventContainsExpectedMsg(errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED,
626626
"Warning", timestamp, expectedErrorMsg);
627627

628628
// check the operator pod log contains the expected error message
@@ -707,7 +707,7 @@ void testErrorPathDomainMissingWDTBinary() {
707707
verifyIntrospectorPodLogContainsExpectedErrorMsg(domainUid, errorpathDomainNamespace, expectedErrorMsg);
708708

709709
// check the domain event contains the expected error message
710-
checkDomainEventContainsExpectedMsg(opNamespace, errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED,
710+
checkDomainEventContainsExpectedMsg(errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED,
711711
"Warning", timestamp, expectedErrorMsg);
712712

713713
// check the operator pod log contains the expected error message
@@ -796,7 +796,7 @@ void testErrorPathDomainMissingDomainConfig() {
796796
verifyIntrospectorPodLogContainsExpectedErrorMsg(domainUid, errorpathDomainNamespace, expectedErrorMsg);
797797

798798
// check the domain event contains the expected error message
799-
checkDomainEventContainsExpectedMsg(opNamespace, errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED,
799+
checkDomainEventContainsExpectedMsg(errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED,
800800
"Warning", timestamp, expectedErrorMsg);
801801

802802
// check the operator pod log contains the expected error message
@@ -904,7 +904,7 @@ void testErrorPathFilePermission() {
904904
verifyIntrospectorPodLogContainsExpectedErrorMsg(domainUid, errorpathDomainNamespace, expectedErrorMsg);
905905

906906
// check the domain event contains the expected error message
907-
checkDomainEventContainsExpectedMsg(opNamespace, errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED,
907+
checkDomainEventContainsExpectedMsg(errorpathDomainNamespace, domainUid, DOMAIN_PROCESSING_FAILED,
908908
"Warning", timestamp, expectedErrorMsg);
909909

910910
// check the operator pod log contains the expected error message

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import static java.util.concurrent.TimeUnit.SECONDS;
3131
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT;
3232
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT;
33+
import static oracle.weblogic.kubernetes.TestConstants.BUSYBOX_IMAGE;
34+
import static oracle.weblogic.kubernetes.TestConstants.BUSYBOX_TAG;
3335
import static oracle.weblogic.kubernetes.TestConstants.DOMAIN_IMAGES_REPO;
3436
import static oracle.weblogic.kubernetes.TestConstants.MII_AUXILIARY_IMAGE_NAME;
3537
import static oracle.weblogic.kubernetes.TestConstants.MII_BASIC_IMAGE_TAG;
@@ -38,13 +40,15 @@
3840
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TO_USE_IN_SPEC;
3941
import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR;
4042
import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR;
43+
import static oracle.weblogic.kubernetes.actions.ActionConstants.WORK_DIR;
4144
import static oracle.weblogic.kubernetes.actions.TestActions.dockerPush;
4245
import static oracle.weblogic.kubernetes.actions.TestActions.getServiceNodePort;
4346
import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.createDomainResourceWithAuxiliaryImageClusterScope;
4447
import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.patchDomainClusterWithAuxImageAndVerify;
4548
import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.readFilesInPod;
4649
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkSystemResourceConfiguration;
4750
import static oracle.weblogic.kubernetes.utils.DomainUtils.createDomainAndVerify;
51+
import static oracle.weblogic.kubernetes.utils.FileUtils.replaceStringInFile;
4852
import static oracle.weblogic.kubernetes.utils.FileUtils.unzipWDTInstallationFile;
4953
import static oracle.weblogic.kubernetes.utils.ImageUtils.createOcirRepoSecret;
5054
import static oracle.weblogic.kubernetes.utils.OperatorUtils.installAndVerifyOperator;
@@ -357,8 +361,18 @@ void testPatchDomainToAddModelsToClusterConfigIgnored() {
357361
}
358362

359363
private void createAuxiliaryImage(String stageDirPath, String dockerFileLocation, String auxiliaryImage) {
364+
//replace the BUSYBOX_IMAGE and BUSYBOX_TAG in Dockerfile
365+
Path dockerDestFile = Paths.get(WORK_DIR, "auximages", "Dockerfile");
366+
assertDoesNotThrow(() -> {
367+
Files.createDirectories(dockerDestFile.getParent());
368+
Files.copy(Paths.get(dockerFileLocation),
369+
dockerDestFile, StandardCopyOption.REPLACE_EXISTING);
370+
replaceStringInFile(dockerDestFile.toString(), "BUSYBOX_IMAGE", BUSYBOX_IMAGE);
371+
replaceStringInFile(dockerDestFile.toString(), "BUSYBOX_TAG", BUSYBOX_TAG);
372+
});
373+
360374
String cmdToExecute = String.format("cd %s && docker build -f %s %s -t %s .",
361-
stageDirPath, dockerFileLocation,
375+
stageDirPath, dockerDestFile.toString(),
362376
"--build-arg AUXILIARY_IMAGE_PATH=" + auxiliaryImagePath, auxiliaryImage);
363377
assertTrue(new Command()
364378
.withParams(new CommandParams()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void testMiiChangeListenPort() {
182182
checkPodLogContainsString(helper.opNamespace, operatorPodName, MII_DYNAMIC_UPDATE_EXPECTED_ERROR_MSG);
183183

184184
// check the domain event contains the expected error message
185-
checkDomainEventContainsExpectedMsg(helper.opNamespace, helper.domainNamespace, domainUid, DOMAIN_PROCESSING_FAILED,
185+
checkDomainEventContainsExpectedMsg(helper.domainNamespace, domainUid, DOMAIN_PROCESSING_FAILED,
186186
"Warning", timestamp, MII_DYNAMIC_UPDATE_EXPECTED_ERROR_MSG);
187187

188188
// clean failed introspector

integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/K8sEvents.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
2929
import static org.junit.jupiter.api.Assertions.assertEquals;
3030
import static org.junit.jupiter.api.Assertions.assertTrue;
31-
import static org.junit.jupiter.api.Assertions.fail;
3231

3332
/**
3433
* Helper class for Kubernetes Events checking.
@@ -429,29 +428,28 @@ public static Callable<Boolean> checkPodEventLoggedOnce(
429428
/**
430429
* Check the domain event contains the expected error msg.
431430
*
432-
* @param opNamespace namespace in which the operator is running
433431
* @param domainNamespace namespace in which the domain exists
434432
* @param domainUid UID of the domain
435433
* @param reason event to check for Created, Changed, deleted, processing etc
436434
* @param type type of event, Normal of Warning
437435
* @param timestamp the timestamp after which to see events
438436
* @param expectedMsg the expected message in the domain event message
439437
*/
440-
public static void checkDomainEventContainsExpectedMsg(String opNamespace,
441-
String domainNamespace,
438+
public static void checkDomainEventContainsExpectedMsg(String domainNamespace,
442439
String domainUid,
443440
String reason,
444441
String type,
445442
OffsetDateTime timestamp,
446443
String expectedMsg) {
447-
checkEvent(opNamespace, domainNamespace, domainUid, reason, type, timestamp);
448-
CoreV1Event event = getOpGeneratedEvent(domainNamespace, reason, type, timestamp);
449-
if (event != null && event.getMessage() != null) {
450-
assertTrue(event.getMessage().contains(expectedMsg),
451-
String.format("The event message does not contain the expected msg %s", expectedMsg));
452-
} else {
453-
fail("event is null or event message is null");
454-
}
444+
withStandardRetryPolicy
445+
.conditionEvaluationListener(condition ->
446+
getLogger().info("Waiting for domain event {0} to be logged in namespace {1} "
447+
+ "(elapsed time {2}ms, remaining time {3}ms)",
448+
reason,
449+
domainNamespace,
450+
condition.getElapsedTimeInMS(),
451+
condition.getRemainingTimeInMS()))
452+
.until(domainEventContainsExpectedMsg(domainNamespace, domainUid, reason, type, timestamp, expectedMsg));
455453
}
456454

457455
private static Callable<Boolean> domainEventContainsExpectedMsg(String domainNamespace,

0 commit comments

Comments
 (0)