Skip to content

Commit 50514bd

Browse files
authored
fix olcne test failures (#2612)
* fix olcne test failures
1 parent 0dcef53 commit 50514bd

File tree

1 file changed

+37
-29
lines changed

1 file changed

+37
-29
lines changed

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

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,16 @@ class ItMiiAuxiliaryImage {
114114
private static String wdtDomainNamespace = null;
115115
private static LoggingFacade logger = null;
116116
private String domainUid = "domain1";
117-
private static String miiAuxiliaryImage1 = MII_AUXILIARY_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG + "1";
118-
private static String miiAuxiliaryImage2 = MII_AUXILIARY_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG + "2";
119-
private static String miiAuxiliaryImage3 = MII_AUXILIARY_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG + "3";
120-
private static String miiAuxiliaryImage4 = MII_AUXILIARY_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG + "4";
121-
private static String miiAuxiliaryImage5 = MII_AUXILIARY_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG + "5";
122-
private static String miiAuxiliaryImage6 = MII_AUXILIARY_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG + "6";
123-
private static String errorPathAuxiliaryImage1 = MII_AUXILIARY_IMAGE_NAME + ":errorpathimage1";
124-
private static String errorPathAuxiliaryImage2 = MII_AUXILIARY_IMAGE_NAME + ":errorpathimage2";
125-
private static String errorPathAuxiliaryImage3 = MII_AUXILIARY_IMAGE_NAME + ":errorpathimage3";
126-
private static String errorPathAuxiliaryImage4 = MII_AUXILIARY_IMAGE_NAME + ":errorpathimage4";
117+
private static String miiAuxiliaryImage1 = MII_AUXILIARY_IMAGE_NAME + "-domain:" + MII_BASIC_IMAGE_TAG + "1";
118+
private static String miiAuxiliaryImage2 = MII_AUXILIARY_IMAGE_NAME + "-domain:" + MII_BASIC_IMAGE_TAG + "2";
119+
private static String miiAuxiliaryImage3 = MII_AUXILIARY_IMAGE_NAME + "-domain:" + MII_BASIC_IMAGE_TAG + "3";
120+
private static String miiAuxiliaryImage4 = MII_AUXILIARY_IMAGE_NAME + "-domain:" + MII_BASIC_IMAGE_TAG + "4";
121+
private static String miiAuxiliaryImage5 = MII_AUXILIARY_IMAGE_NAME + "-domain:" + MII_BASIC_IMAGE_TAG + "5";
122+
private static String miiAuxiliaryImage6 = MII_AUXILIARY_IMAGE_NAME + "-domain:" + MII_BASIC_IMAGE_TAG + "6";
123+
private static String errorPathAuxiliaryImage1 = MII_AUXILIARY_IMAGE_NAME + "-domain:errorpathimage1";
124+
private static String errorPathAuxiliaryImage2 = MII_AUXILIARY_IMAGE_NAME + "-domain:errorpathimage2";
125+
private static String errorPathAuxiliaryImage3 = MII_AUXILIARY_IMAGE_NAME + "-domain:errorpathimage3";
126+
private static String errorPathAuxiliaryImage4 = MII_AUXILIARY_IMAGE_NAME + "-domain:errorpathimage4";
127127
private static Map<String, OffsetDateTime> podsWithTimeStamps = null;
128128
private final String adminServerPodName = domainUid + "-admin-server";
129129
private final String managedServerPrefix = domainUid + "-managed-server";
@@ -193,12 +193,13 @@ void testCreateDomainUsingMultipleAuxiliaryImages() {
193193
"weblogicenc", "weblogicenc");
194194

195195
// create stage dir for first auxiliary image with image1
196-
Path multipleAIPath1 = Paths.get(RESULTS_ROOT, "multipleauxiliaryimage1");
196+
Path multipleAIPath1 = Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "multipleauxiliaryimage1");
197197
assertDoesNotThrow(() -> FileUtils.deleteDirectory(multipleAIPath1.toFile()),
198198
"Delete directory failed");
199199
assertDoesNotThrow(() -> Files.createDirectories(multipleAIPath1),
200200
"Create directory failed");
201-
Path multipleAIPathToFile1 = Paths.get(RESULTS_ROOT, "multipleauxiliaryimage1/test.txt");
201+
Path multipleAIPathToFile1 =
202+
Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "multipleauxiliaryimage1/test.txt");
202203
String content = "1";
203204
assertDoesNotThrow(() -> Files.write(multipleAIPathToFile1, content.getBytes()),
204205
"Can't write to file " + multipleAIPathToFile1);
@@ -241,7 +242,7 @@ void testCreateDomainUsingMultipleAuxiliaryImages() {
241242
}
242243

243244
// create stage dir for second auxiliary image with image2
244-
Path multipleAIPath2 = Paths.get(RESULTS_ROOT, "multipleauxiliaryimage2");
245+
Path multipleAIPath2 = Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "multipleauxiliaryimage2");
245246
assertDoesNotThrow(() -> FileUtils.deleteDirectory(multipleAIPath2.toFile()),
246247
"Delete directory failed");
247248
assertDoesNotThrow(() -> Files.createDirectories(multipleAIPath2),
@@ -250,7 +251,8 @@ void testCreateDomainUsingMultipleAuxiliaryImages() {
250251
// create models dir and copy model, archive files if any
251252
Path modelsPath2 = Paths.get(multipleAIPath2.toString(), "models");
252253
assertDoesNotThrow(() -> Files.createDirectories(modelsPath2));
253-
Path multipleAIPathToFile2 = Paths.get(RESULTS_ROOT, "multipleauxiliaryimage2/test.txt");
254+
Path multipleAIPathToFile2 =
255+
Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "multipleauxiliaryimage2/test.txt");
254256
String content2 = "2";
255257
assertDoesNotThrow(() -> Files.write(multipleAIPathToFile2, content2.getBytes()),
256258
"Can't write to file " + multipleAIPathToFile2);
@@ -287,14 +289,17 @@ void testCreateDomainUsingMultipleAuxiliaryImages() {
287289
checkConfiguredJMSresouce(domainNamespace, adminServerPodName);
288290

289291
//checking the order of loading for the auxiliary images, expecting file with content =2
290-
assertDoesNotThrow(() -> FileUtils.deleteQuietly(Paths.get(RESULTS_ROOT, "/test.txt").toFile()));
292+
assertDoesNotThrow(() ->
293+
FileUtils.deleteQuietly(Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "/test.txt").toFile()));
291294
assertDoesNotThrow(() -> copyFileFromPod(domainNamespace,
292295
adminServerPodName, "weblogic-server",
293296
auxiliaryImagePath + "/test.txt",
294-
Paths.get(RESULTS_ROOT, "/test.txt")), " Can't find file in the pod, or failed to copy");
297+
Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "/test.txt")),
298+
" Can't find file in the pod, or failed to copy");
295299

296300
assertDoesNotThrow(() -> {
297-
String fileContent = Files.readAllLines(Paths.get(RESULTS_ROOT, "/test.txt")).get(0);
301+
String fileContent =
302+
Files.readAllLines(Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "/test.txt")).get(0);
298303
assertEquals("2", fileContent, "The content of the file from auxiliary image path "
299304
+ fileContent + "does not match the expected 2");
300305
}, "File from image2 was not loaded in the expected order");
@@ -309,7 +314,7 @@ void testCreateDomainUsingMultipleAuxiliaryImages() {
309314
@Order(2)
310315
@DisplayName("Test to update data source url in the domain using auxiliary image")
311316
void testUpdateDataSourceInDomainUsingAuxiliaryImage() {
312-
Path multipleAIPath1 = Paths.get(RESULTS_ROOT, "multipleauxiliaryimage1");
317+
Path multipleAIPath1 = Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "multipleauxiliaryimage1");
313318
Path modelsPath1 = Paths.get(multipleAIPath1.toString(), "models");
314319

315320

@@ -435,7 +440,7 @@ void testErrorPathDomainMismatchMountPath() {
435440
createSecretsForDomain(adminSecretName, encryptionSecretName, errorpathDomainNamespace);
436441

437442
// create stage dir for auxiliary image
438-
Path errorpathAIPath1 = Paths.get(RESULTS_ROOT, "errorpathauxiimage1");
443+
Path errorpathAIPath1 = Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "errorpathauxiimage1");
439444
assertDoesNotThrow(() -> FileUtils.deleteDirectory(errorpathAIPath1.toFile()),
440445
"Delete directory failed");
441446
assertDoesNotThrow(() -> Files.createDirectories(errorpathAIPath1),
@@ -517,7 +522,7 @@ void testErrorPathDomainMissingWDTBinary() {
517522
createSecretsForDomain(adminSecretName, encryptionSecretName, errorpathDomainNamespace);
518523

519524
// create stage dir for auxiliary image
520-
Path errorpathAIPath2 = Paths.get(RESULTS_ROOT, "errorpathauxiimage2");
525+
Path errorpathAIPath2 = Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "errorpathauxiimage2");
521526
assertDoesNotThrow(() -> FileUtils.deleteDirectory(errorpathAIPath2.toFile()),
522527
"Delete directory failed");
523528
assertDoesNotThrow(() -> Files.createDirectories(errorpathAIPath2),
@@ -600,7 +605,7 @@ void testErrorPathDomainMissingDomainConfig() {
600605
createSecretsForDomain(adminSecretName, encryptionSecretName, errorpathDomainNamespace);
601606

602607
// create stage dir for auxiliary image
603-
Path errorpathAIPath3 = Paths.get(RESULTS_ROOT, "errorpathauxiimage3");
608+
Path errorpathAIPath3 = Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "errorpathauxiimage3");
604609
assertDoesNotThrow(() -> FileUtils.deleteDirectory(errorpathAIPath3.toFile()),
605610
"Delete directory failed");
606611
assertDoesNotThrow(() -> Files.createDirectories(errorpathAIPath3),
@@ -778,13 +783,14 @@ void testErrorPathFilePermission() {
778783
createSecretsForDomain(adminSecretName, encryptionSecretName, errorpathDomainNamespace);
779784

780785
// create stage dir for auxiliary image
781-
Path errorpathAIPath1 = Paths.get(RESULTS_ROOT, "errorpathauxiimage4");
786+
Path errorpathAIPath1 = Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "errorpathauxiimage4");
782787
assertDoesNotThrow(() -> FileUtils.deleteDirectory(errorpathAIPath1.toFile()),
783788
"Can't delete directory");
784789
assertDoesNotThrow(() -> Files.createDirectories(errorpathAIPath1),
785790
"Can't create directory");
786791

787-
Path errorpathAIPathToFile = Paths.get(RESULTS_ROOT, "errorpathauxiimage4/test1.txt");
792+
Path errorpathAIPathToFile =
793+
Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "errorpathauxiimage4/test1.txt");
788794
String content = "some text ";
789795
assertDoesNotThrow(() -> Files.write(errorpathAIPathToFile, content.getBytes()),
790796
"Can't write to file " + errorpathAIPathToFile);
@@ -896,7 +902,7 @@ void testUpdateWDTVersionUsingMultipleAuxiliaryImages() {
896902
"weblogicenc", "weblogicenc");
897903

898904
// create stage dir for first auxiliary image containing domain configuration
899-
Path multipleAIPath1 = Paths.get(RESULTS_ROOT, "multipleauxiliaryimage1");
905+
Path multipleAIPath1 = Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "multipleauxiliaryimage1");
900906
assertDoesNotThrow(() -> FileUtils.deleteDirectory(multipleAIPath1.toFile()),
901907
"Delete directory failed");
902908
assertDoesNotThrow(() -> Files.createDirectories(multipleAIPath1),
@@ -937,7 +943,7 @@ void testUpdateWDTVersionUsingMultipleAuxiliaryImages() {
937943
}
938944

939945
// create stage dir for second auxiliary image
940-
Path multipleAIPath2 = Paths.get(RESULTS_ROOT, "multipleauxiliaryimage2");
946+
Path multipleAIPath2 = Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "multipleauxiliaryimage2");
941947
assertDoesNotThrow(() -> FileUtils.deleteDirectory(multipleAIPath2.toFile()),
942948
"Delete directory failed");
943949
assertDoesNotThrow(() -> Files.createDirectories(multipleAIPath2), "Create directory failed");
@@ -963,7 +969,7 @@ void testUpdateWDTVersionUsingMultipleAuxiliaryImages() {
963969
}
964970

965971
// create stage dir for third auxiliary image with latest wdt installation files only
966-
Path multipleAIPath3 = Paths.get(RESULTS_ROOT, "multipleauxiliaryimage3");
972+
Path multipleAIPath3 = Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "multipleauxiliaryimage3");
967973
assertDoesNotThrow(() -> FileUtils.deleteDirectory(multipleAIPath3.toFile()),
968974
"Delete directory failed");
969975
assertDoesNotThrow(() -> Files.createDirectories(multipleAIPath3),
@@ -1220,14 +1226,16 @@ private void checkConfiguredJDBCresouce(String domainNamespace, String adminServ
12201226
}
12211227

12221228
private String checkWDTVersion(String domainNamespace, String auxiliaryImagePath) throws Exception {
1223-
assertDoesNotThrow(() -> FileUtils.deleteQuietly(Paths.get(RESULTS_ROOT, "/WDTversion.txt").toFile()));
1229+
assertDoesNotThrow(() ->
1230+
FileUtils.deleteQuietly(Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "/WDTversion.txt").toFile()));
12241231
assertDoesNotThrow(() -> copyFileFromPod(domainNamespace,
12251232
adminServerPodName, "weblogic-server",
12261233
auxiliaryImagePath + "/weblogic-deploy/VERSION.txt",
1227-
Paths.get(RESULTS_ROOT, "/WDTversion.txt")), " Can't find file in the pod, or failed to copy");
1234+
Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "/WDTversion.txt")),
1235+
" Can't find file in the pod, or failed to copy");
12281236

12291237

1230-
return Files.readAllLines(Paths.get(RESULTS_ROOT, "/WDTversion.txt")).get(0);
1238+
return Files.readAllLines(Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(), "/WDTversion.txt")).get(0);
12311239
}
12321240

12331241
private boolean introspectorPodLogContainsExpectedErrorMsg(String domainUid,

0 commit comments

Comments
 (0)