Skip to content

Commit 9df87d0

Browse files
committed
fix
1 parent ddca530 commit 9df87d0

File tree

2 files changed

+26
-19
lines changed

2 files changed

+26
-19
lines changed

integration-tests/src/test/java/oracle/kubernetes/operator/ITPodsRestart.java

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -197,22 +197,27 @@ public void testServerPodsRestartByChangingZImage() throws Exception {
197197
logTestBegin(testMethodName);
198198

199199
try {
200+
ExecAndPrintLog("docker images");
200201
logger.info(
201202
"About to verifyDomainServerPodRestart for Domain: "
202203
+ domain.getDomainUid()
203204
+ " Image property: "
204205
+ getWeblogicImageName()
205206
+ ":"
206207
+ getWeblogicImageTag()
207-
+ " to /weblogick8s/middleware/weblogic:duplicate");
208+
+ " to "
209+
+ System.getenv("REPO_REGISTRY")
210+
+ "/weblogick8s/middleware/weblogic:duplicate");
208211

209212
if (BaseTest.SHARED_CLUSTER) {
210213
String newImage =
211214
System.getenv("REPO_REGISTRY") + "/weblogick8s/middleware/weblogic:duplicate";
212215

216+
String tag =
217+
"docker tag " + getWeblogicImageName() + ":" + getWeblogicImageTag() + " " + newImage;
213218
// tag image with repo name
214-
TestUtils.exec(
215-
"docker tag " + getWeblogicImageName() + ":" + getWeblogicImageTag() + " " + newImage);
219+
ExecAndPrintLog(tag);
220+
ExecAndPrintLog("docker images");
216221

217222
// login and push image to ocir
218223
TestUtils.loginAndPushImageToOCIR(newImage);
@@ -230,26 +235,15 @@ public void testServerPodsRestartByChangingZImage() throws Exception {
230235
String command =
231236
"kubectl create secret docker-registry docker-store "
232237
+ "--docker-server="
233-
+ BaseTest.getWeblogicImageServer()
238+
+ System.getenv("REPO_REGISTRY")
234239
+ " --docker-username="
235-
+ System.getenv("OCR_USERNAME")
240+
+ System.getenv("REPO_USERNAME")
236241
+ " --docker-password="
237-
+ System.getenv("OCR_PASSWORD")
242+
+ System.getenv("REPO_PASSWORD")
238243
+ " -n "
239244
+ domain.getDomainNS()
240245
+ " --dry-run -o yaml | kubectl apply -f - ";
241-
242-
logger.info("Executing " + command);
243-
ExecResult result = ExecCommand.exec(command);
244-
logger.info(
245-
"Command "
246-
+ command
247-
+ " return value "
248-
+ result.exitValue()
249-
+ " \n failed with stderr = "
250-
+ result.stderr()
251-
+ " \n stdout = "
252-
+ result.stdout());
246+
ExecAndPrintLog(command);
253247

254248
// apply new domain yaml and verify pod restart
255249
domain.verifyDomainServerPodRestart(
@@ -277,6 +271,19 @@ public void testServerPodsRestartByChangingZImage() throws Exception {
277271
logger.info("SUCCESS - " + testMethodName);
278272
}
279273

274+
private void ExecAndPrintLog(String command) throws Exception {
275+
ExecResult result = ExecCommand.exec(command);
276+
logger.info(
277+
"Command "
278+
+ command
279+
+ "\nreturn value: "
280+
+ result.exitValue()
281+
+ "\nstderr = "
282+
+ result.stderr()
283+
+ "\nstdout = "
284+
+ result.stdout());
285+
}
286+
280287
/**
281288
* Modify/Add the containerSecurityContext section at ServerPod Level using kubectl apply -f
282289
* cont.security.context.domain.yaml. Verify all the pods re-started. The property tested is:

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,10 @@ public void deployWebAppViaREST(
386386
.append("/management/weblogic/latest/edit/appDeployments")
387387
.append(" --write-out %{http_code} ");
388388
logger.info("Command to deploy webapp " + cmd);
389+
logger.info(getHostNameForCurl());
389390
ExecResult result = TestUtils.exec(cmd.toString());
390391
String output = result.stdout().trim();
391392
logger.info("curl output " + output + " \n err " + result.stderr());
392-
logger.info(getHostNameForCurl());
393393
if (!output.contains("202")) {
394394
throw new RuntimeException("FAILURE: Webapp deployment failed with response code " + output);
395395
}

0 commit comments

Comments
 (0)