Skip to content

Commit f4bc146

Browse files
authored
OWLS-90664,Added test to check the order of loading images in AI (#2450)
* added test for ds update
1 parent bc0a8e2 commit f4bc146

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@
6262
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getExternalServicePodName;
6363
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getPodsWithTimeStamps;
6464
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.installAndVerifyOperator;
65+
import static oracle.weblogic.kubernetes.utils.FileUtils.copyFileFromPod;
6566
import static oracle.weblogic.kubernetes.utils.FileUtils.replaceStringInFile;
6667
import static oracle.weblogic.kubernetes.utils.FileUtils.unzipWDTInstallationFile;
6768
import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
6869
import static org.awaitility.Awaitility.with;
6970
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
71+
import static org.junit.jupiter.api.Assertions.assertEquals;
7072
import static org.junit.jupiter.api.Assertions.assertFalse;
7173
import static org.junit.jupiter.api.Assertions.assertNotEquals;
7274
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -149,6 +151,10 @@ public void testCreateDomainUsingMultipleAuxiliaryImages() {
149151
Path multipleAIPath1 = Paths.get(RESULTS_ROOT, "multipleauxiliaryimage1");
150152
assertDoesNotThrow(() -> FileUtils.deleteDirectory(multipleAIPath1.toFile()));
151153
assertDoesNotThrow(() -> Files.createDirectories(multipleAIPath1));
154+
Path multipleAIPathToFile1 = Paths.get(RESULTS_ROOT, "multipleauxiliaryimage1/test.txt");
155+
String content = "1";
156+
assertDoesNotThrow(() -> Files.write(multipleAIPathToFile1, content.getBytes()),
157+
"Can't write to file " + multipleAIPathToFile1);
152158

153159
// create models dir and copy model, archive files if any for image1
154160
Path modelsPath1 = Paths.get(multipleAIPath1.toString(), "models");
@@ -195,6 +201,10 @@ public void testCreateDomainUsingMultipleAuxiliaryImages() {
195201
// create models dir and copy model, archive files if any
196202
Path modelsPath2 = Paths.get(multipleAIPath2.toString(), "models");
197203
assertDoesNotThrow(() -> Files.createDirectories(modelsPath2));
204+
Path multipleAIPathToFile2 = Paths.get(RESULTS_ROOT, "multipleauxiliaryimage2/test.txt");
205+
String content2 = "2";
206+
assertDoesNotThrow(() -> Files.write(multipleAIPathToFile2, content2.getBytes()),
207+
"Can't write to file " + multipleAIPathToFile2);
198208
assertDoesNotThrow(() -> Files.copy(
199209
Paths.get(MODEL_DIR, "/model.jms2.yaml"),
200210
Paths.get(modelsPath2.toString(), "/model.jms2.yaml"),
@@ -231,6 +241,19 @@ public void testCreateDomainUsingMultipleAuxiliaryImages() {
231241
assertTrue(checkSystemResourceConfiguration(adminServiceNodePort, "JMSSystemResources",
232242
"TestClusterJmsModule2", "200"), "JMSSystemResources not found");
233243
logger.info("Found the JMSSystemResource configuration");
244+
245+
//checking the order of loading for the common mount images, expecting file with content =2
246+
assertDoesNotThrow(() -> FileUtils.deleteQuietly(Paths.get(RESULTS_ROOT, "/test.txt").toFile()));
247+
assertDoesNotThrow(() -> copyFileFromPod(domainNamespace,
248+
adminServerPodName, "weblogic-server",
249+
auxiliaryImagePath + "/test.txt",
250+
Paths.get(RESULTS_ROOT, "/test.txt")), " Can't find file in the pod, or failed to copy");
251+
252+
assertDoesNotThrow(() -> {
253+
String fileContent = Files.readAllLines(Paths.get(RESULTS_ROOT, "/test.txt")).get(0);
254+
assertEquals("2", fileContent, "The content of the file from common mount path "
255+
+ fileContent + "does not match the expected 2");
256+
}, "File from image2 was not loaded in the expected order");
234257
}
235258

236259
/**
@@ -242,7 +265,6 @@ public void testCreateDomainUsingMultipleAuxiliaryImages() {
242265
@Order(2)
243266
@DisplayName("Test to update data source url in the domain using auxiliary image")
244267
public void testUpdateDataSourceInDomainUsingAuxiliaryImage() {
245-
246268
Path multipleAIPath1 = Paths.get(RESULTS_ROOT, "multipleauxiliaryimage1");
247269
Path modelsPath1 = Paths.get(multipleAIPath1.toString(), "models");
248270

0 commit comments

Comments
 (0)