Skip to content

Commit 43a22fe

Browse files
use TestUtil.exec() for command exec
1 parent 600f582 commit 43a22fe

File tree

3 files changed

+13
-31
lines changed

3 files changed

+13
-31
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ public void testServerPodsRestartByChangingEnvProperty() throws Exception {
8484

8585
boolean testCompletedSuccessfully = false;
8686
logger.info(
87-
"About to testDomainServerRestart for Domain: "
87+
"About to testDomainServerPodRestart for Domain: "
8888
+ domain.getDomainUid()
8989
+ " env property: StdoutDebugEnabled=false to StdoutDebugEnabled=true");
90-
domain.testDomainServerRestart(
90+
domain.testDomainServerPodRestart(
9191
"\"-Dweblogic.StdoutDebugEnabled=false\"", "\"-Dweblogic.StdoutDebugEnabled=true\"");
9292

9393
logger.info("SUCCESS - " + testMethodName);
@@ -107,10 +107,10 @@ public void testServerPodsRestartByChangingLogHomeEnabled() throws Exception {
107107
boolean testCompletedSuccessfully = false;
108108

109109
logger.info(
110-
"About to testDomainServerRestart for Domain: "
110+
"About to testDomainServerPodRestart for Domain: "
111111
+ domain.getDomainUid()
112112
+ " logHomeEnabled: true --> logHomeEnabled: false");
113-
domain.testDomainServerRestart("logHomeEnabled: true", "logHomeEnabled: false");
113+
domain.testDomainServerPodRestart("logHomeEnabled: true", "logHomeEnabled: false");
114114

115115
logger.info("SUCCESS - " + testMethodName);
116116
}
@@ -129,10 +129,10 @@ public void testServerPodsRestartByChangingImagePullPolicy() throws Exception {
129129
boolean testCompletedSuccessfully = false;
130130

131131
logger.info(
132-
"About to testDomainServerRestart for Domain: "
132+
"About to testDomainServerPodRestart for Domain: "
133133
+ domain.getDomainUid()
134134
+ " imagePullPolicy: IfNotPresent --> imagePullPolicy: Never ");
135-
domain.testDomainServerRestart(
135+
domain.testDomainServerPodRestart(
136136
"imagePullPolicy: \"IfNotPresent\"", "imagePullPolicy: \"Never\" ");
137137

138138
logger.info("SUCCESS - " + testMethodName);
@@ -152,10 +152,10 @@ public void testServerPodsRestartByChangingIncludeServerOutInPodLog() throws Exc
152152
boolean testCompletedSuccessfully = false;
153153

154154
logger.info(
155-
"About to testDomainServerRestart for Domain: "
155+
"About to testDomainServerPodRestart for Domain: "
156156
+ domain.getDomainUid()
157157
+ " includeServerOutInPodLog: true --> includeServerOutInPodLog: false");
158-
domain.testDomainServerRestart(
158+
domain.testDomainServerPodRestart(
159159
"includeServerOutInPodLog: true", "includeServerOutInPodLog: false");
160160

161161
logger.info("SUCCESS - " + testMethodName);
@@ -176,11 +176,11 @@ public void testServerPodsRestartByChangingImage() throws Exception {
176176
boolean testCompletedSuccessfully = false;
177177
try {
178178
logger.info(
179-
"About to testDomainServerRestart for Domain: "
179+
"About to testDomainServerPodRestart for Domain: "
180180
+ domain.getDomainUid()
181181
+ " Image property: store/oracle/weblogic:12.2.1.3 to store/oracle/weblogic:duplicate");
182182
TestUtils.dockerTagImage("store/oracle/weblogic:12.2.1.3", "store/oracle/weblogic:duplicate");
183-
domain.testDomainServerRestart(
183+
domain.testDomainServerPodRestart(
184184
"\"store/oracle/weblogic:12.2.1.3\"", "\"store/oracle/weblogic:duplicate\"");
185185
} finally {
186186
TestUtils.dockerRemoveImage("store/oracle/weblogic:duplicate");

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
@@ -850,7 +850,7 @@ private void createPV() throws Exception {
850850
new PersistentVolume("/scratch/acceptance_test_pv/persistentVolume-" + domainUid, pvMap);
851851
}
852852

853-
public void testDomainServerRestart(String oldPropertyString, String newPropertyString)
853+
public void testDomainServerPodRestart(String oldPropertyString, String newPropertyString)
854854
throws Exception {
855855
logger.info("Inside testDomainServerPodRestart");
856856
String content =

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

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,31 +1110,13 @@ public static void dockerTagImage(String sourceImage, String targetImage) throws
11101110
logger.info("Tagging souceImage: " + sourceImage + " to " + targetImage);
11111111
String dockerCmd = "docker tag " + sourceImage + " " + targetImage;
11121112
logger.info("Executing cmd " + dockerCmd);
1113-
1114-
ExecResult result = ExecCommand.exec(dockerCmd);
1115-
if (result.exitValue() != 0) {
1116-
throw new RuntimeException(
1117-
"FAILURE: command to create load balancer "
1118-
+ dockerCmd
1119-
+ " failed, returned "
1120-
+ result.stdout()
1121-
+ result.stderr());
1122-
}
1113+
exec(dockerCmd);
11231114
}
11241115

11251116
public static void dockerRemoveImage(String imageName) throws Exception {
11261117
logger.info("Removing image: " + imageName);
11271118
String dockerCmd = "docker rmi -f " + imageName;
11281119
logger.info("Executing cmd " + dockerCmd);
1129-
1130-
ExecResult result = ExecCommand.exec(dockerCmd);
1131-
if (result.exitValue() != 0) {
1132-
throw new RuntimeException(
1133-
"FAILURE: command to create load balancer "
1134-
+ dockerCmd
1135-
+ " failed, returned "
1136-
+ result.stdout()
1137-
+ result.stderr());
1138-
}
1120+
exec(dockerCmd);
11391121
}
11401122
}

0 commit comments

Comments
 (0)