Skip to content

Commit 6d9a7cd

Browse files
committed
Merge remote-tracking branch 'origin/develop' into affinity
2 parents 88cf8d2 + 1a399ce commit 6d9a7cd

33 files changed

+723
-154
lines changed

integration-tests/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,13 @@ The below env variables are required for SHARED_CLUSTER=true:
232232

233233
| Variable | Description |
234234
| --- | --- |
235-
| REPO_REGISTRY | OCIR Server to push/pull the Operator image |
236-
| REPO_USERNAME | OCIR Username |
237-
| REPO_PASSWORD | OCIR token |
238-
| REPO_EMAIL | OCIR email |
235+
| REPO_REGISTRY | OCR Server to push/pull the Operator image |
236+
| REPO_USERNAME | OCR username |
237+
| REPO_PASSWORD | OCR password |
238+
| REPO_EMAIL | OCR e-mail |
239239
| DOCKER_USERNAME | Docker username to pull the Weblogic image |
240240
| DOCKER_PASSWORD | Docker password |
241-
| DOCKER_EMAIL | Docker email |
241+
| DOCKER_EMAIL | Docker e-mail |
242242
| K8S_NODEPORT_HOST | DNS name of a Kubernetes worker node. |
243243

244244
Successful run will have the output like below:
@@ -303,9 +303,9 @@ JUnit test results can be seen at "integration-tests/target/failsafe-reports/TES
303303
- And get access to FMW Infrastructure 12c Image: **_container-registry.oracle.com/middleware/fmw-infrastructure:12.2.1.3_**
304304
- export the following before running the tests:
305305
```
306-
export REPO_USERNAME=<ocir_username>
307-
export REPO_PASSWORD=<ocir_password>
308-
export REPO_EMAIL=<ocir_email>
306+
export REPO_USERNAME=<ocr_username>
307+
export REPO_PASSWORD=<ocr_password>
308+
export REPO_EMAIL=<ocr_email>
309309
```
310310
311311
Method 2

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public class BaseTest {
7272
private static String appLocationOnHost;
7373
private static Properties appProps;
7474
private static String weblogicImageTag;
75+
private static String weblogicImageDevTag;
7576
private static String weblogicImageName;
7677
private static String weblogicImageServer;
7778
private static String domainApiVersion;
@@ -114,6 +115,10 @@ public static void initialize(String appPropsFile) throws Exception {
114115
System.getenv("IMAGE_TAG_WEBLOGIC") != null
115116
? System.getenv("IMAGE_TAG_WEBLOGIC")
116117
: appProps.getProperty("weblogicImageTag");
118+
weblogicImageDevTag =
119+
System.getenv("IMAGE_DEVTAG_WEBLOGIC") != null
120+
? System.getenv("IMAGE_DEVTAG_WEBLOGIC")
121+
: appProps.getProperty("weblogicImageDevTag");
117122
weblogicImageName =
118123
System.getenv("IMAGE_NAME_WEBLOGIC") != null
119124
? System.getenv("IMAGE_NAME_WEBLOGIC")
@@ -257,6 +262,15 @@ public static void initialize(String appPropsFile) throws Exception {
257262
public static String getWeblogicImageTag() {
258263
return weblogicImageTag;
259264
}
265+
266+
/**
267+
* getter method for weblogicImageDevTag field.
268+
*
269+
* @return image tag of the WLS Dev docker images
270+
*/
271+
public static String getWeblogicImageDevTag() {
272+
return weblogicImageDevTag;
273+
}
260274

261275
/**
262276
* getter method for weblogicImageName.

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

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,37 +124,60 @@ public static void staticUnPrepare() throws Exception {
124124
logger.info("SUCCESS");
125125
}
126126
}
127-
127+
128128
private static void verifyElasticStackReady() throws Exception {
129129
// Get Logstash info
130130
String healthStatus = execElasticStackStatusCheck("*logstash*", "$1");
131131
String indexStatus = execElasticStackStatusCheck("*logstash*", "$2");
132132
String indexName = execElasticStackStatusCheck("*logstash*", "$3");
133133

134-
// Verify that the health status of Logstash
135134
Assume.assumeNotNull(healthStatus);
135+
Assume.assumeNotNull(indexStatus);
136+
Assume.assumeNotNull(indexName);
137+
// Verify that the health status of Logstash
136138
Assume.assumeTrue(
137139
"Logstash is not ready!",
138-
healthStatus.equalsIgnoreCase("yellow") || healthStatus.equalsIgnoreCase("green"));
140+
healthStatus.equalsIgnoreCase("yellow") ||
141+
healthStatus.equalsIgnoreCase("green"));
139142
// Verify that the index is open for use
140-
Assume.assumeNotNull(indexStatus);
141-
Assume.assumeTrue("Logstash index is not open!", indexStatus.equalsIgnoreCase("open"));
143+
Assume.assumeTrue("Logstash index is not open!",
144+
indexStatus.equalsIgnoreCase("open"));
142145
// Add the index name to a Map
143-
Assume.assumeNotNull(indexName);
144146
testVarMap.put("indexName", indexName);
145147

146148
// Get Kibana info
147149
healthStatus = execElasticStackStatusCheck("*kibana*", "$1");
148150
indexStatus = execElasticStackStatusCheck("*kibana*", "$2");
149-
150-
// Verify that the health status of Kibana
151+
indexName = execElasticStackStatusCheck("*kibana*", "$3");
152+
151153
Assume.assumeNotNull(healthStatus);
152-
Assume.assumeTrue(
153-
"Kibana is not ready!",
154-
healthStatus.equalsIgnoreCase("yellow") || healthStatus.equalsIgnoreCase("green"));
155-
// Verify that the index is open for use
156154
Assume.assumeNotNull(indexStatus);
157-
Assume.assumeTrue("Kibana index is not open!", indexStatus.equalsIgnoreCase("open"));
155+
Assume.assumeNotNull(indexName);
156+
157+
//There are multiple indexes from Kibana 6.8.0
158+
String[] kibanahealthStatusArr =
159+
healthStatus.split(System.getProperty("line.separator"));
160+
String[] kibanaindexStatusArr =
161+
indexStatus.split(System.getProperty("line.separator"));
162+
String[] kibanaindexNameArr =
163+
indexName.split(System.getProperty("line.separator"));
164+
165+
for(int i = 0; i < kibanaindexStatusArr.length; i++) {
166+
logger.info("Health status of " + kibanaindexNameArr[i] +
167+
"is:" + kibanahealthStatusArr[i]);
168+
logger.info("Index status of " + kibanaindexNameArr[i] +
169+
"is:" + kibanaindexStatusArr[i]);
170+
// Verify that the health status of Kibana
171+
Assume.assumeTrue(
172+
"Kibana is not ready!",
173+
kibanahealthStatusArr[i].trim().equalsIgnoreCase("yellow") ||
174+
kibanahealthStatusArr[i].trim().equalsIgnoreCase("green"));
175+
// Verify that the index is open for use
176+
Assume.assumeTrue("Kibana index is not open!",
177+
kibanaindexStatusArr[i].trim().equalsIgnoreCase("open"));
178+
}
179+
180+
logger.info("ELK Stack is up and running and ready to use!");
158181
}
159182

160183
private static String execElasticStackStatusCheck(String indexName, String varLoc)

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -852,13 +852,12 @@ private void fireAlert() throws Exception {
852852

853853
TestUtils.checkPodReady("domain1-admin-server", "default");
854854
TestUtils.checkPodReady("domain1-managed-server-1", "default");
855-
//sleep for 2 min to fire alert
856-
Thread.sleep(120000);
855+
857856
String webhookPod = getPodName("webhook", "webhook");
858857
String command = "kubectl -n webhook logs " + webhookPod;
859-
ExecResult webhookResult = TestUtils.exec(command);
858+
859+
ExecResult webhookResult = TestUtils.checkAnyCmdInLoop(command, "Some WLS cluster has only one running server for more than 1 minutes");
860860
logger.info(" webhook log " + webhookResult.stdout());
861-
assertTrue(webhookResult.stdout().contains("Some WLS cluster has only one running server for more than 1 minutes"));
862861
}
863862

864863
private static String getPodName(String app, String namespace) throws Exception {

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

Lines changed: 21 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public void testServerPodsRestartByChangingIncludeServerOutInPodLog() throws Exc
207207
* Modify the domain scope property on the domain resource using kubectl apply -f domain.yaml
208208
* Verify that all the server pods in the domain got re-started .The property tested is: image:
209209
* "container-registry.oracle.com/middleware/weblogic:12.2.1.3" --> image:
210-
* "container-registry.oracle.com/middleware/weblogic:duplicate"
210+
* "container-registry.oracle.com/middleware/weblogic:12.2.1.3-dev"
211211
*
212212
* @throws Exception exception
213213
*/
@@ -217,63 +217,26 @@ public void testServerPodsRestartByChangingZImage() throws Exception {
217217
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
218218
logTestBegin(testMethodName);
219219

220-
try {
221-
TestUtils.exec("docker images", true);
222-
logger.info(
223-
"About to verifyDomainServerPodRestart for Domain: "
224-
+ domain.getDomainUid()
225-
+ " Image property: "
226-
+ getWeblogicImageName()
227-
+ ":"
228-
+ getWeblogicImageTag()
229-
+ " to "
230-
+ "/weblogick8s/middleware/weblogic:duplicate");
231-
232-
if (BaseTest.SHARED_CLUSTER) {
233-
String newImage =
234-
System.getenv("REPO_REGISTRY") + "/weblogick8s/middleware/weblogic:duplicate";
235-
// tag image with repo name
236-
String tag =
237-
"docker tag " + getWeblogicImageName() + ":" + getWeblogicImageTag() + " " + newImage;
238-
TestUtils.exec(tag, true);
239-
TestUtils.exec("docker images", true);
240-
241-
// login and push image to ocir
242-
TestUtils.loginAndPushImageToOcir(newImage);
243-
244-
// create ocir registry secret in the same ns as domain which is used while pulling the
245-
// image
246-
TestUtils.createDockerRegistrySecret(
247-
"docker-store",
248-
System.getenv("REPO_REGISTRY"),
249-
System.getenv("REPO_USERNAME"),
250-
System.getenv("REPO_PASSWORD"),
251-
System.getenv("REPO_EMAIL"),
252-
domain.getDomainNs());
253-
254-
// apply new domain yaml and verify pod restart
255-
domain.verifyDomainServerPodRestart(
256-
"\"" + getWeblogicImageName() + ":" + getWeblogicImageTag() + "\"",
257-
"\"" + newImage + "\"");
258-
259-
} else {
260-
TestUtils.exec(
261-
"docker tag "
262-
+ getWeblogicImageName()
263-
+ ":"
264-
+ getWeblogicImageTag()
265-
+ " "
266-
+ getWeblogicImageName()
267-
+ ":duplicate");
268-
domain.verifyDomainServerPodRestart(
269-
"\"" + getWeblogicImageName() + ":" + getWeblogicImageTag() + "\"",
270-
"\"" + getWeblogicImageName() + ":duplicate" + "\"");
271-
}
272-
} finally {
273-
if (!BaseTest.SHARED_CLUSTER) {
274-
TestUtils.exec("docker rmi -f " + getWeblogicImageName() + ":duplicate");
275-
}
276-
}
220+
221+
TestUtils.exec("docker images", true);
222+
logger.info(
223+
"About to verifyDomainServerPodRestart for Domain: "
224+
+ domain.getDomainUid()
225+
+ " Image property: "
226+
+ getWeblogicImageName()
227+
+ ":"
228+
+ getWeblogicImageTag()
229+
+ " to "
230+
+ getWeblogicImageName()
231+
+ ":"
232+
+ getWeblogicImageDevTag());
233+
234+
String newImage = getWeblogicImageName() + ":" + getWeblogicImageDevTag();
235+
TestUtils.exec("docker pull " + newImage, true);
236+
// apply new domain yaml and verify pod restart
237+
domain.verifyDomainServerPodRestart(
238+
"\"" + getWeblogicImageName() + ":" + getWeblogicImageTag() + "\"",
239+
"\"" + newImage + "\"");
277240

278241
logger.info("SUCCESS - " + testMethodName);
279242
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,7 +1682,7 @@ private void copyCreateDomainPy() throws IOException {
16821682
.toPath(),
16831683
new File(
16841684
BaseTest.getResultDir()
1685-
+ "/samples/scripts/create-fmw-infrastructure-domain/common/createFMWDomain.py")
1685+
+ "/samples/scripts/create-fmw-infrastructure-domain/domain-home-on-pv/common/createFMWDomain.py")
16861686
.toPath(),
16871687
StandardCopyOption.REPLACE_EXISTING);
16881688
} else {
@@ -1721,7 +1721,7 @@ private String prepareCmdToCallCreateDomainScript(String outputDir) {
17211721
.append(" -k -i ");
17221722
} else if (domainMap.containsKey("rcuDatabaseURL")) {
17231723
createDomainScriptCmd.append(
1724-
"/samples/scripts/create-fmw-infrastructure-domain/create-domain.sh -v -i ");
1724+
"/samples/scripts/create-fmw-infrastructure-domain/domain-home-on-pv/create-domain.sh -v -i ");
17251725
} else {
17261726
createDomainScriptCmd.append(
17271727
"/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain.sh -v -i ");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private void updateDomainMapForJrf(boolean adminPortEnabled) throws Exception {
6969
if (adminPortEnabled) {
7070
String createDomainScript =
7171
BaseTest.getResultDir()
72-
+ "/samples/scripts/create-fmw-infrastructure-domain/wlst/create-domain-script.sh";
72+
+ "/samples/scripts/create-fmw-infrastructure-domain/domain-home-on-pv/wlst/create-domain-script.sh";
7373
TestUtils.replaceStringInFile(
7474
createDomainScript,
7575
"-managedNameBase ",

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,49 @@ private static KeyStore createKeyStore(Operator operator) throws Exception {
12241224
return myKeyStore;
12251225
}
12261226

1227+
/**
1228+
*
1229+
* @param cmd command to run in the loop
1230+
* @param matchStr expected string to match in the output
1231+
* @return ExecResult object containing command output info
1232+
* @throws Exception exception if fails to execute
1233+
*/
1234+
public static ExecResult checkAnyCmdInLoop(String cmd, String matchStr)
1235+
throws Exception {
1236+
int i = 0;
1237+
ExecResult result = null;
1238+
while (i < BaseTest.getMaxIterationsPod()) {
1239+
result = ExecCommand.exec(cmd);
1240+
1241+
if (result.exitValue() != 0
1242+
|| (result.exitValue() == 0 && !result.stdout().contains(matchStr))) {
1243+
logger.info("Output for " + cmd + "\n" + result.stdout() + "\n " + result.stderr());
1244+
// check for last iteration
1245+
if (i == (BaseTest.getMaxIterationsPod() - 1)) {
1246+
throw new RuntimeException(
1247+
"FAILURE: expected output " + matchStr + " from command " + cmd + " is not receieved, exiting!");
1248+
}
1249+
logger.info(
1250+
"did not receive the expected output "
1251+
+ matchStr
1252+
+ "from command " + cmd + " Ite ["
1253+
+ i
1254+
+ "/"
1255+
+ BaseTest.getMaxIterationsPod()
1256+
+ "], sleeping "
1257+
+ BaseTest.getWaitTimePod()
1258+
+ " seconds more");
1259+
1260+
Thread.sleep(BaseTest.getWaitTimePod() * 1000);
1261+
i++;
1262+
} else {
1263+
logger.info("Command " + cmd + " is successful");
1264+
break;
1265+
}
1266+
}
1267+
return result;
1268+
}
1269+
12271270
public static void checkCmdInLoop(String cmd, String matchStr, String k8sObjName)
12281271
throws Exception {
12291272
int i = 0;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ password=welcome1
88
maxIterationsPod=25
99
waitTimePod=10
1010
weblogicImageTag = 12.2.1.3
11+
weblogicImageDevTag = 12.2.1.3-dev
1112
weblogicImageName = container-registry.oracle.com/middleware/weblogic
12-
OCR_SERVER="container-registry.oracle.com"
13+
OCR_SERVER=container-registry.oracle.com
1314
DOMAIN_API_VERSION = weblogic.oracle/v4

integration-tests/src/test/resources/operator_elk.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ domainNamespaces: [ "default", "test1" ]
99
externalRestEnabled: true
1010
javaLoggingLevel: INFO
1111
elkIntegrationEnabled: true
12-
logStashImage: "logstash:6.6.0"
12+
logStashImage: "logstash:6.8.0"
1313
elasticSearchHost: "elasticsearch.default.svc.cluster.local"
1414
elasticSearchPort: 9200

0 commit comments

Comments
 (0)