Skip to content

Commit b002968

Browse files
committed
Merge remote-tracking branch 'origin/develop' into externalJenkins-integ-test
2 parents b5f9ee6 + 3c861c8 commit b002968

File tree

22 files changed

+426
-31
lines changed

22 files changed

+426
-31
lines changed

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/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/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)