14
14
import java .util .logging .Level ;
15
15
import oracle .kubernetes .operator .utils .Domain ;
16
16
import oracle .kubernetes .operator .utils .DomainCRD ;
17
- import oracle .kubernetes .operator .utils .ExecCommand ;
18
17
import oracle .kubernetes .operator .utils .ExecResult ;
19
18
import oracle .kubernetes .operator .utils .K8sTestUtils ;
20
19
import oracle .kubernetes .operator .utils .Operator ;
@@ -197,25 +196,7 @@ public void testServerPodsRestartByChangingZImage() throws Exception {
197
196
logTestBegin (testMethodName );
198
197
199
198
try {
200
- ExecAndPrintLog ("docker images" );
201
- String images1 [] = {
202
- "aa168fda9148" ,
203
- "f4ebe13a774d" ,
204
- "1a0416dcad6b" ,
205
- "11311c769c45" ,
206
- "752895b7af34" ,
207
- "f284edce6956" ,
208
- "27ded50d518c" ,
209
- "6cdb96a19a82" ,
210
- "4d0e7bd02c03" ,
211
- "85dfdb97e0de" ,
212
- "d58f0d158db5" ,
213
- "d58f0d158db5"
214
- };
215
- for (String image : images1 ) {
216
- ExecAndPrintLog ("docker rmi -f " + image );
217
- }
218
- ExecAndPrintLog ("docker images" );
199
+ TestUtils .ExecAndPrintLog ("docker images" );
219
200
logger .info (
220
201
"About to verifyDomainServerPodRestart for Domain: "
221
202
+ domain .getDomainUid ()
@@ -231,20 +212,20 @@ public void testServerPodsRestartByChangingZImage() throws Exception {
231
212
String newImage =
232
213
System .getenv ("REPO_REGISTRY" ) + "/weblogick8s/middleware/weblogic:duplicate" ;
233
214
215
+ // tag image with repo name
234
216
String tag =
235
217
"docker tag " + getWeblogicImageName () + ":" + getWeblogicImageTag () + " " + newImage ;
236
- // tag image with repo name
237
- ExecAndPrintLog (tag );
238
- ExecAndPrintLog ("docker images" );
218
+ TestUtils .ExecAndPrintLog (tag );
219
+ TestUtils .ExecAndPrintLog ("docker images" );
239
220
240
- ExecAndPrintLog (
221
+ TestUtils . ExecAndPrintLog (
241
222
"docker login "
242
223
+ System .getenv ("REPO_REGISTRY" )
243
224
+ " -u "
244
225
+ System .getenv ("REPO_USERNAME" )
245
226
+ " -p "
246
227
+ System .getenv ("REPO_PASSWORD" ));
247
- ExecAndPrintLog ("docker push " + newImage );
228
+ TestUtils . ExecAndPrintLog ("docker push " + newImage );
248
229
249
230
// login and push image to ocir
250
231
// TestUtils.loginAndPushImageToOCIR(newImage);
@@ -259,7 +240,7 @@ public void testServerPodsRestartByChangingZImage() throws Exception {
259
240
260
241
// domain.getDomainNS());
261
242
262
- ExecAndPrintLog (
243
+ TestUtils . ExecAndPrintLog (
263
244
"kubectl create secret docker-registry docker-store "
264
245
+ "--docker-server="
265
246
+ System .getenv ("REPO_REGISTRY" )
@@ -281,7 +262,7 @@ public void testServerPodsRestartByChangingZImage() throws Exception {
281
262
+ " -n "
282
263
+ domain .getDomainNS ()
283
264
+ " --dry-run -o yaml | kubectl apply -f - " ;
284
- ExecAndPrintLog (command );
265
+ TestUtils . ExecAndPrintLog (command );
285
266
286
267
// apply new domain yaml and verify pod restart
287
268
domain .verifyDomainServerPodRestart (
@@ -309,19 +290,6 @@ public void testServerPodsRestartByChangingZImage() throws Exception {
309
290
logger .info ("SUCCESS - " + testMethodName );
310
291
}
311
292
312
- private void ExecAndPrintLog (String command ) throws Exception {
313
- ExecResult result = ExecCommand .exec (command );
314
- logger .info (
315
- "\n Command "
316
- + command
317
- + "\n return value: "
318
- + result .exitValue ()
319
- + "\n stderr = "
320
- + result .stderr ()
321
- + "\n stdout = "
322
- + result .stdout ());
323
- }
324
-
325
293
/**
326
294
* Modify/Add the containerSecurityContext section at ServerPod Level using kubectl apply -f
327
295
* cont.security.context.domain.yaml. Verify all the pods re-started. The property tested is:
0 commit comments