@@ -49,7 +49,7 @@ public class ITImagetool extends BaseTest {
4949 @ BeforeClass
5050 public static void staticPrepare () throws Exception {
5151 logger .info ("prepare for image tool test ..." );
52-
52+ // initialize
5353 initialize ();
5454 // clean up the env first
5555 cleanup ();
@@ -107,6 +107,7 @@ public void test2CacheAddInstallerJDK() throws Exception {
107107 logTestBegin (testMethodName );
108108
109109 String jdkPath = getInstallerCacheDir () + FS + JDK_INSTALLER ;
110+ deleteEntryFromCache ("jdk_" + JDK_VERSION );
110111 addInstallerToCache ("jdk" , JDK_VERSION , jdkPath );
111112
112113 ExecResult result = listItemsInCache ();
@@ -126,6 +127,7 @@ public void test3CacheAddInstallerWLS() throws Exception {
126127 logTestBegin (testMethodName );
127128
128129 String wlsPath = getInstallerCacheDir () + FS + WLS_INSTALLER ;
130+ deleteEntryFromCache ("wls_" + WLS_VERSION );
129131 addInstallerToCache ("wls" , WLS_VERSION , wlsPath );
130132
131133 ExecResult result = listItemsInCache ();
@@ -144,9 +146,12 @@ public void test4CreateWLSImg() throws Exception {
144146 String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
145147 logTestBegin (testMethodName );
146148
147- String command = imagetool + " create --jdkVersion=" + JDK_VERSION + " --tag imagetool:" + testMethodName ;
149+ String command = imagetool + " create --jdkVersion=" + JDK_VERSION + " --tag " +
150+ build_tag + ":" + testMethodName ;
148151 logger .info ("Executing command: " + command );
149- ExecCommand .exec (command , true );
152+ ExecResult result = ExecCommand .exec (command );
153+ logger .info ("DEBUG: result.stdout=" + result .stdout ());
154+ logger .info ("DEBUG: result.stderr=" + result .stderr ());
150155
151156 // verify the docker image is created
152157 verifyDockerImages (testMethodName );
@@ -227,10 +232,11 @@ public void test8CreateWLSImgUseCache() throws Exception {
227232
228233 // need to add the required patches 28186730 for Opatch before create wls images
229234 String patchPath = getInstallerCacheDir () + FS + P28186730_INSTALLER ;
235+ deleteEntryFromCache (P28186730_ID + "_opatch" );
230236 addPatchToCache ("wls" , P28186730_ID , OPATCH_VERSION , patchPath );
231237
232238 String command = imagetool + " create --jdkVersion " + JDK_VERSION + " --fromImage " +
233- BASE_OS_IMG + ":" + BASE_OS_IMG_TAG + " --tag imagetool :" + testMethodName +
239+ BASE_OS_IMG + ":" + BASE_OS_IMG_TAG + " --tag " + build_tag + " :" + testMethodName +
234240 " --version " + WLS_VERSION ;
235241 logger .info ("Executing command: " + command );
236242 ExecCommand .exec (command , true );
@@ -250,8 +256,8 @@ public void test9UpdateWLSImg() throws Exception {
250256 String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
251257 logTestBegin (testMethodName );
252258
253- String command = imagetool + " update --fromImage imagetool:test8CreateWLSImgUseCache --tag imagetool: " +
254- testMethodName + " --patches " + P27342434_ID ;
259+ String command = imagetool + " update --fromImage imagetool:test8CreateWLSImgUseCache --tag " +
260+ build_tag + ":" + testMethodName + " --patches " + P27342434_ID ;
255261 logger .info ("Executing command: " + command );
256262 ExecCommand .exec (command , true );
257263
@@ -307,7 +313,7 @@ public void testACreateWLSImgUsingWDT() throws Exception {
307313 String wdtModel = getWDTResourcePath () + FS + WDT_MODEL ;
308314 String wdtVariables = getWDTResourcePath () + FS + WDT_VARIABLES ;
309315 String command = imagetool + " create --fromImage " +
310- BASE_OS_IMG + ":" + BASE_OS_IMG_TAG + " --tag imagetool :" + testMethodName +
316+ BASE_OS_IMG + ":" + BASE_OS_IMG_TAG + " --tag " + build_tag + " :" + testMethodName +
311317 " --version " + WLS_VERSION + " --patches " + P27342434_ID + " --wdtVersion " + WDT_VERSION +
312318 " --wdtArchive " + wdtArchive + " --wdtDomainHome /u01/domains/simple_domain --wdtModel " +
313319 wdtModel + " --wdtVariables " + wdtVariables ;
@@ -343,7 +349,7 @@ public void testBCreateFMWImgFullInternetAccess() throws Exception {
343349 String jdkPath = getInstallerCacheDir () + FS + JDK_INSTALLER ;
344350 addInstallerToCache ("jdk" , JDK_VERSION , jdkPath );
345351
346- String command = imagetool + " create --version=" + WLS_VERSION + " --tag imagetool :" + testMethodName +
352+ String command = imagetool + " create --version=" + WLS_VERSION + " --tag " + build_tag + " :" + testMethodName +
347353 " --latestPSU --user " + oracleSupportUsername + " --passwordEnv ORACLE_SUPPORT_PASSWORD --type fmw" ;
348354 logger .info ("Executing command: " + command );
349355 ExecCommand .exec (command , true );
@@ -365,18 +371,21 @@ public void testCCreateFMWImgNonDefault() throws Exception {
365371
366372 // add fmw installer to the cache
367373 String fmwPath = getInstallerCacheDir () + FS + FMW_INSTALLER_1221 ;
374+ deleteEntryFromCache ("fmw_" + WLS_VERSION_1221 );
368375 addInstallerToCache ("fmw" , WLS_VERSION_1221 , fmwPath );
369376
370377 // add jdk installer to the cache
371378 String jdkPath = getInstallerCacheDir () + FS + JDK_INSTALLER_8u212 ;
379+ deleteEntryFromCache ("jdk_" + JDK_VERSION_8u212 );
372380 addInstallerToCache ("jdk" , JDK_VERSION_8u212 , jdkPath );
373381
374382 // add the patch to the cache
375383 String patchPath = getInstallerCacheDir () + FS + P22987840_INSTALLER ;
384+ deleteEntryFromCache (P22987840_ID + "_" + WLS_VERSION_1221 );
376385 addPatchToCache ("fmw" , P22987840_ID , WLS_VERSION_1221 , patchPath );
377386
378387 String command = imagetool + " create --jdkVersion " + JDK_VERSION_8u212 + " --version=" + WLS_VERSION_1221 +
379- " --tag imagetool :" + testMethodName + " --patches " + P22987840_ID + " --type fmw" ;
388+ " --tag " + build_tag + " :" + testMethodName + " --patches " + P22987840_ID + " --type fmw" ;
380389 logger .info ("Executing command: " + command );
381390 ExecCommand .exec (command , true );
382391
@@ -429,13 +438,13 @@ public void testDCreateJRFDomainImgUsingWDT() throws Exception {
429438 Path dest = Paths .get (tmpWdtModel );
430439 Files .copy (source , dest , StandardCopyOption .REPLACE_EXISTING );
431440 String getDBContainerIP = "docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' " +
432- DB_CONTAINER_NAME ;
441+ dbContainerName ;
433442 String host = ExecCommand .exec (getDBContainerIP ).stdout ().trim ();
434443 logger .info ("DEBUG: DB_HOST=" + host );
435444 replaceStringInFile (tmpWdtModel , "%DB_HOST%" , host );
436445
437446 String command = imagetool + " create --fromImage " +
438- BASE_OS_IMG + ":" + BASE_OS_IMG_TAG + " --tag imagetool :" + testMethodName +
447+ BASE_OS_IMG + ":" + BASE_OS_IMG_TAG + " --tag " + build_tag + " :" + testMethodName +
439448 " --version " + WLS_VERSION + " --wdtVersion " + WDT_VERSION +
440449 " --wdtArchive " + wdtArchive + " --wdtDomainHome /u01/domains/simple_domain --wdtModel " +
441450 tmpWdtModel + " --wdtDomainType JRF --wdtRunRCU --type fmw" ;
@@ -483,7 +492,7 @@ public void testECreateRestricedJRFDomainImgUsingWDT() throws Exception {
483492 String wdtModel = getWDTResourcePath () + FS + WDT_MODEL ;
484493 String wdtVariables = getWDTResourcePath () + FS + WDT_VARIABLES ;
485494 String command = imagetool + " create --fromImage " +
486- BASE_OS_IMG + ":" + BASE_OS_IMG_TAG + " --tag imagetool :" + testMethodName +
495+ BASE_OS_IMG + ":" + BASE_OS_IMG_TAG + " --tag " + build_tag + " :" + testMethodName +
487496 " --version " + WLS_VERSION + " --latestPSU --user " + oracleSupportUsername +
488497 " --password " + oracleSupportPassword + " --wdtVersion " + WDT_VERSION +
489498 " --wdtArchive " + wdtArchive + " --wdtDomainHome /u01/domains/simple_domain --wdtModel " +
@@ -535,7 +544,7 @@ public void testFCreateWLSImgUsingMultiModels() throws Exception {
535544 String wdtModel2 = getWDTResourcePath () + FS + WDT_MODEL2 ;
536545 String wdtVariables = getWDTResourcePath () + FS + WDT_VARIABLES ;
537546 String command = imagetool + " create --fromImage " +
538- BASE_OS_IMG + ":" + BASE_OS_IMG_TAG + " --tag imagetool :" + testMethodName +
547+ BASE_OS_IMG + ":" + BASE_OS_IMG_TAG + " --tag " + build_tag + " :" + testMethodName +
539548 " --version " + WLS_VERSION + " --wdtVersion " + WDT_VERSION +
540549 " --wdtArchive " + wdtArchive + " --wdtDomainHome /u01/domains/simple_domain --wdtModel " +
541550 wdtModel + "," + wdtModel2 + " --wdtVariables " + wdtVariables ;
0 commit comments