@@ -17,22 +17,20 @@ public class BaseTest {
17
17
protected static final Logger logger = Logger .getLogger (ITImagetool .class .getName ());
18
18
protected static final String PS = File .pathSeparator ;
19
19
protected static final String FS = File .separator ;
20
- private static final String OCIR_SERVER = "phx.ocir.io" ;
21
- private static final String OCIR_TENENT = "weblogick8s" ;
22
- private static final String OCR_SERVER = "container-registry.oracle.com" ;
23
20
protected static final String BASE_OS_IMG = "phx.ocir.io/weblogick8s/oraclelinux" ;
24
21
protected static final String BASE_OS_IMG_TAG = "7-4imagetooltest" ;
25
- protected static final String ORACLE_DB_IMG = "container-registry.oracle.com /database/enterprise" ;
22
+ protected static final String ORACLE_DB_IMG = "phx.ocir.io/weblogick8s /database/enterprise" ;
26
23
protected static final String ORACLE_DB_IMG_TAG = "12.2.0.1-slim" ;
27
- private static final String DB_CONTAINER_NAME = "InfraDB" ;
24
+ protected static final String DB_CONTAINER_NAME = "InfraDB" ;
28
25
private static String projectRoot = "" ;
29
26
protected static String wlsImgBldDir = "" ;
30
27
protected static String wlsImgCacheDir = "" ;
31
28
protected static String imagetool = "" ;
32
29
private static int maxIterations = 50 ;
33
30
private static int waitTime = 5 ;
34
- private static String IMAGETOOLZIPFILE = "imagetool.zip" ;
35
- private static String IMAGETOOLDIR = "imagetool" ;
31
+ private static final String IMAGETOOLZIPFILE = "imagetool.zip" ;
32
+ private static final String IMAGETOOLDIR = "imagetool" ;
33
+ private static final String INSTALLERCACHEDIR = "/scratch/artifacts/imagetool" ;
36
34
37
35
protected static void initialize () throws Exception {
38
36
logger .info ("Initializing the tests ..." );
@@ -61,11 +59,11 @@ protected static void initialize() throws Exception {
61
59
protected static void setup () throws Exception {
62
60
63
61
logger .info ("Setting up the test environment ..." );
64
- String command = "/bin/ rm -rf " + getImagetoolHome ();
62
+ String command = "rm -rf " + getImagetoolHome ();
65
63
executeNoVerify (command );
66
64
67
65
// unzip the weblogic-image-tool/imagetool/target/imagetool.zip
68
- command = "/bin/ unzip " + getTargetDir () + FS + IMAGETOOLZIPFILE ;
66
+ command = "unzip " + getTargetDir () + FS + IMAGETOOLZIPFILE ;
69
67
executeNoVerify (command );
70
68
71
69
command = "source " + getImagetoolHome () + FS + "bin" + FS + "setup.sh" ;
@@ -74,10 +72,10 @@ protected static void setup() throws Exception {
74
72
75
73
protected static void cleanup () throws Exception {
76
74
logger .info ("cleaning up the test environment ..." );
77
- String command = "/bin/ rm -rf " + wlsImgCacheDir ;
75
+ String command = "rm -rf " + wlsImgCacheDir ;
78
76
executeNoVerify (command );
79
77
80
- command = "/bin/ mkdir " + wlsImgCacheDir ;
78
+ command = "mkdir " + wlsImgCacheDir ;
81
79
executeNoVerify (command );
82
80
83
81
// clean up the docker images
@@ -88,35 +86,18 @@ protected static void cleanup() throws Exception {
88
86
executeNoVerify (command );
89
87
90
88
// clean up the possible left over wlsimgbuilder_temp*
91
- command = "/bin/ rm -rf " + wlsImgBldDir + FS + "wlsimgbuilder_temp*" ;
89
+ command = "rm -rf " + wlsImgBldDir + FS + "wlsimgbuilder_temp*" ;
92
90
executeNoVerify (command );
93
91
}
94
92
95
93
protected static void pullBaseOSDockerImage () throws Exception {
96
94
logger .info ("Pulling OS base images from OCIR ..." );
97
- String ocir_username = System .getenv ("OCIR_USERNAME" );
98
- String ocir_password = System .getenv ("OCIR_PASSWORD" );
99
-
100
- if (ocir_username == null || ocir_password == null ) {
101
- throw new Exception ("You need to set OCIR_USERNAME and OCIR_PASSWORD environment variable to pull base" +
102
- " OS image " + BASE_OS_IMG + ":" + BASE_OS_IMG_TAG );
103
- }
104
-
105
- pullDockerImage (OCIR_SERVER , OCIR_TENENT + "/" + ocir_username , ocir_password , BASE_OS_IMG ,
106
- BASE_OS_IMG_TAG );
95
+ pullDockerImage (BASE_OS_IMG , BASE_OS_IMG_TAG );
107
96
}
108
97
109
98
protected static void pullOracleDBDockerImage () throws Exception {
110
- logger .info ("Pulling Oracle DB image from OCR ..." );
111
- String ocr_username = System .getenv ("OCR_USERNAME" );
112
- String ocr_password = System .getenv ("OCR_PASSWORD" );
113
-
114
- if (ocr_username == null || ocr_password == null ) {
115
- throw new Exception ("You need to set OCR_USERNAME and OCR_PASSWORD environment variable to pull DB " +
116
- "image " + ORACLE_DB_IMG + ":" + ORACLE_DB_IMG_TAG );
117
- }
118
-
119
- pullDockerImage (OCR_SERVER , ocr_username , ocr_password , ORACLE_DB_IMG , ORACLE_DB_IMG_TAG );
99
+ logger .info ("Pulling Oracle DB image from OCIR ..." );
100
+ pullDockerImage (ORACLE_DB_IMG , ORACLE_DB_IMG_TAG );
120
101
}
121
102
122
103
protected static void downloadInstallers (String ... installers ) throws Exception {
@@ -157,7 +138,7 @@ protected static String getImagetoolHome() throws Exception {
157
138
}
158
139
159
140
protected static String getInstallerCacheDir () {
160
- return getProjectRoot () + FS + "caches" ;
141
+ return INSTALLERCACHEDIR ;
161
142
}
162
143
163
144
protected static String getWDTResourcePath () {
@@ -265,11 +246,8 @@ private ExecResult executeAndVerify(String command, boolean isRedirectToOut) thr
265
246
return result ;
266
247
}
267
248
268
- private static void pullDockerImage (String repoServer , String username , String password ,
269
- String imagename , String imagetag ) throws Exception {
249
+ private static void pullDockerImage (String imagename , String imagetag ) throws Exception {
270
250
271
- ExecCommand .exec ("docker login " + repoServer + " -u " + username +
272
- " -p " + password );
273
251
ExecCommand .exec ("docker pull " + imagename + ":" + imagetag );
274
252
275
253
// verify the docker image is pulled
0 commit comments