Skip to content

Commit fbb13f4

Browse files
committed
remove docker images and wlsimgbuilder_temp* dir in cleanup
1 parent 6c15736 commit fbb13f4

File tree

1 file changed

+23
-12
lines changed
  • imagetool/src/test/java/com/oracle/weblogic/imagetool/integration

1 file changed

+23
-12
lines changed

imagetool/src/test/java/com/oracle/weblogic/imagetool/integration/BaseTest.java

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,27 +53,33 @@ protected static void initialize() throws Exception {
5353

5454
protected static void setup() throws Exception {
5555

56-
logger.info("Setting up the test ...");
56+
logger.info("Setting up the test environment ...");
5757
String command = "/bin/rm -rf " + getImagetoolHome();
58-
logger.info("Executing command: " + command);
59-
ExecCommand.exec(command);
58+
executeNoVerify(command);
6059

6160
// unzip the weblogic-image-tool/imagetool/target/imagetool-${VERSION}-SNAPSHOT.zip
6261
command = "/bin/unzip " + getTargetDir() + FS + imagetoolZipfile;
63-
logger.info("Executing command: " + command);
64-
ExecCommand.exec(command);
62+
executeNoVerify(command);
6563

6664
command = "source " + getImagetoolHome() + FS + "bin" + FS + "setup.sh";
67-
logger.info("Executing command: " + command );
68-
ExecCommand.exec(command);
65+
executeNoVerify(command);
6966
}
7067

7168
protected static void cleanup() throws Exception {
72-
logger.info("cleaning up cache entries");
73-
logger.info("executing command: /bin/rm -rf " + wlsImgCacheDir);
74-
ExecCommand.exec("/bin/rm -rf " + wlsImgCacheDir);
75-
logger.info("executing command: /bin/mkdir " + wlsImgCacheDir);
76-
ExecCommand.exec("/bin/mkdir " + wlsImgCacheDir);
69+
logger.info("cleaning up the test environment ...");
70+
String command = "/bin/rm -rf " + wlsImgCacheDir;
71+
executeNoVerify(command);
72+
73+
command = "/bin/mkdir " + wlsImgCacheDir;
74+
executeNoVerify(command);
75+
76+
// clean up the docker images
77+
command = "docker rmi -f " + BASE_OS_IMG + ":" + BASE_OS_IMG_TAG;
78+
executeNoVerify(command);
79+
80+
// clean up the possible left over wlsimgbuilder_temp*
81+
command = "/bin/rm -rf " + wlsImgBldDir + FS + "wlsimgbuilder_temp*";
82+
executeNoVerify(command);
7783
}
7884

7985
protected static void pullDockerImage() throws Exception {
@@ -134,6 +140,11 @@ protected static String getWDTResourcePath() {
134140
return getProjectRoot() + FS + "src" + FS + "test" + FS + "resources" + FS + "wdt";
135141
}
136142

143+
protected static void executeNoVerify(String command) throws Exception {
144+
logger.info("executing command: " + command);
145+
ExecCommand.exec(command);
146+
}
147+
137148
protected void verifyResult(ExecResult result, String matchString) throws Exception {
138149
if(result.exitValue() != 0 || !result.stdout().contains(matchString)) {
139150
throw new Exception("verifying test result failed.");

0 commit comments

Comments
 (0)