Skip to content

Commit 50956b3

Browse files
committed
use fields to use values from OperatorIT.properties instead of hardcoding
1 parent 3a6e3a1 commit 50956b3

File tree

4 files changed

+44
-12
lines changed

4 files changed

+44
-12
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public class BaseTest {
6969
protected static String appLocationInPod = "/u01/oracle/apps";
7070
private static String appLocationOnHost;
7171
private static Properties appProps;
72+
private static String imageTag;
73+
private static String imageName;
7274

7375
// Set QUICKTEST env var to true to run a small subset of tests.
7476
// Set SMOKETEST env var to true to run an even smaller subset of tests
@@ -104,6 +106,8 @@ public static void initialize(String appPropsFile) throws Exception {
104106
}
105107
username = appProps.getProperty("username", username);
106108
password = appProps.getProperty("password", password);
109+
imageTag = appProps.getProperty("weblogicImageTag");
110+
imageName = appProps.getProperty("weblogicImageName");
107111
maxIterationsPod =
108112
new Integer(appProps.getProperty("maxIterationsPod", "" + maxIterationsPod)).intValue();
109113
waitTimePod = new Integer(appProps.getProperty("waitTimePod", "" + waitTimePod)).intValue();
@@ -227,6 +231,23 @@ public static void initialize(String appPropsFile) throws Exception {
227231
logger.info("Env var BRANCH_NAME " + System.getenv("BRANCH_NAME"));
228232
}
229233

234+
/**
235+
* getter method for imageTag field
236+
*
237+
* @return image tag of the WLS docker images
238+
*/
239+
public static String getImageTag() {
240+
return imageTag;
241+
}
242+
243+
/**
244+
* getter method for imageName
245+
*
246+
* @return image name of the WLS docker image
247+
*/
248+
public static String getImageName() {
249+
return imageName;
250+
}
230251
/**
231252
* Call the basic usecases tests
232253
*

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

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,16 +199,18 @@ public void testServerPodsRestartByChangingZImage() throws Exception {
199199
logger.info(
200200
"About to verifyDomainServerPodRestart for Domain: "
201201
+ domain.getDomainUid()
202-
+ " Image property: container-registry.oracle.com/middleware/weblogic:12.2.1.3-190111 to container-registry.oracle.com/middleware/weblogic:duplicate");
202+
+ " Image property: "
203+
+ getImageName()
204+
+ ":"
205+
+ getImageTag()
206+
+ " to /weblogick8s/middleware/weblogic:duplicate");
203207

204208
if (BaseTest.SHARED_CLUSTER) {
205209
String newImage =
206210
System.getenv("REPO_REGISTRY") + "/weblogick8s/middleware/weblogic:duplicate";
207211

208212
// tag image with repo name
209-
TestUtils.exec(
210-
"docker tag container-registry.oracle.com/middleware/weblogic:12.2.1.3-190111 "
211-
+ newImage);
213+
TestUtils.exec("docker tag " + getImageName() + ":" + getImageTag() + " " + newImage);
212214

213215
// login and push image to ocir
214216
TestUtils.loginAndPushImageToOCIR(newImage);
@@ -225,18 +227,23 @@ public void testServerPodsRestartByChangingZImage() throws Exception {
225227

226228
// apply new domain yaml and verify pod restart
227229
domain.verifyDomainServerPodRestart(
228-
"\"container-registry.oracle.com/middleware/weblogic:12.2.1.3-190111\"",
229-
"\"" + newImage + "\"");
230+
"\"" + getImageName() + ":" + getImageTag() + "\"", "\"" + newImage + "\"");
230231
} else {
231232
TestUtils.exec(
232-
"docker tag container-registry.oracle.com/middleware/weblogic:12.2.1.3-190111 container-registry.oracle.com/middleware/weblogic:duplicate");
233+
"docker tag "
234+
+ getImageName()
235+
+ ":"
236+
+ getImageTag()
237+
+ " "
238+
+ getImageName()
239+
+ ":duplicate");
233240
domain.verifyDomainServerPodRestart(
234-
"\"container-registry.oracle.com/middleware/weblogic:12.2.1.3-190111\"",
235-
"\"container-registry.oracle.com/middleware/weblogic:duplicate\"");
241+
"\"" + getImageName() + ":" + getImageTag() + "\"",
242+
"\"" + getImageName() + ":duplicate" + "\"");
236243
}
237244
} finally {
238245
if (!BaseTest.SHARED_CLUSTER) {
239-
TestUtils.exec("docker rmi -f container-registry.oracle.com/middleware/weblogic:duplicate");
246+
TestUtils.exec("docker rmi -f " + getImageName() + ":duplicate");
240247
}
241248
}
242249

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ public class Domain {
6161
protected String userProjectsDir = "";
6262
private String projectRoot = "";
6363
private boolean ingressPerDomain = true;
64-
private String imageTag = "12.2.1.3";
65-
private String imageName = "middleware/weblogic";
64+
private String imageTag;
65+
private String imageName;
6666

6767
protected String generatedInputYamlFile;
6868

@@ -1384,6 +1384,8 @@ private void callWebAppAndCheckForServerNameInResponse(
13841384
* accessed to read or if creating config map or secret fails for configoverrides
13851385
*/
13861386
protected void initialize(Map<String, Object> inputDomainMap) throws Exception {
1387+
imageTag = BaseTest.getImageTag();
1388+
imageName = BaseTest.getImageName();
13871389
domainMap = inputDomainMap;
13881390
this.userProjectsDir = BaseTest.getUserProjectsDir();
13891391
this.projectRoot = BaseTest.getProjectRoot();

integration-tests/src/test/resources/OperatorIT.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ username=weblogic
77
password=welcome1
88
maxIterationsPod=25
99
waitTimePod=10
10+
weblogicImageTag = 12.2.1.3-190111
11+
weblogicImageName = container-registry.oracle.com/middleware/weblogic

0 commit comments

Comments
 (0)