Skip to content

Commit 1dbbbbc

Browse files
committed
added monitoring exporter test and utility to build and start it part 3
1 parent 115a991 commit 1dbbbbc

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public static void staticPrepare() throws Exception {
8585
metricsUrl = exporterUrl + "metrics";
8686
configPath = BaseTest.getProjectRoot() + "/integration-tests/src/test/resources/exporter/";
8787

88-
DeployRunMonitoringExporter();
88+
deployRunMonitoringExporter(domain, operator);
8989
upgradeTraefikHostName();
9090
buildDeployWebServiceApp(domain, TESTWSAPP, TESTWSSERVICE);
9191
}
@@ -116,18 +116,21 @@ public static void staticUnPrepare() throws Exception {
116116
}
117117

118118
/**
119-
* clone, build , deploy monitoring exporter
119+
* clone, build , deploy monitoring exporter on specified domain, operator
120120
*
121121
* @throws Exception
122122
*/
123-
private static void DeployRunMonitoringExporter() throws Exception {
123+
private static void deployRunMonitoringExporter(Domain domain, Operator operator)
124+
throws Exception {
124125

125126
TestUtils.gitCloneBuildMonitoringExporter();
126127
logger.info("Creating Operator & waiting for the script to complete execution");
127128
boolean testCompletedSuccessfully = false;
128129
startExporterPrometheusGrafana(domain, operator);
130+
// check if exporter is up
131+
domain.callWebAppAndVerifyLoadBalancing("wls-exporter", false);
129132
testCompletedSuccessfully = true;
130-
logger.info("SUCCESS - DeployRunMonitoringExporter");
133+
logger.info("SUCCESS - deployRunMonitoringExporter");
131134
}
132135

133136
/**
@@ -255,7 +258,6 @@ public void test01_ReplaceConfiguration() throws Exception {
255258
boolean isFoundOldKey1 = true;
256259
boolean isFoundOldKey2 = true;
257260

258-
logger.info("Checking configuration for " + searchKey1);
259261
isFoundNewKey1 = checkMetrics(searchKey1);
260262
isFoundNewKey2 = checkMetrics(searchKey2);
261263
isFoundOldKey1 = checkMetrics(testWSAppTotalServletInvokesSearchKey1);

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ public static void createDirUnderDomainPV(String dirPath) throws Exception {
935935

936936
/**
937937
* A utility method to copy Cross Namespaces RBAC yaml template file replacing the DOMAIN_NS,
938-
* OPERATOR_NS and DOMAINUID.
938+
* OPERATOR_NS
939939
*
940940
* @throws IOException when copying files from source location to staging area fails
941941
*/
@@ -947,11 +947,6 @@ private static void createCrossNSRBACFile(String domainNS, String operatorNS) th
947947
logger.log(Level.INFO, "Copying {0}", src.toString());
948948
Charset charset = StandardCharsets.UTF_8;
949949
String content = new String(Files.readAllBytes(src), charset);
950-
/*
951-
content = content.replaceAll("@DOMAIN_NS@", domainNS);
952-
content = content.replaceAll("@DOMAIN_UID@", domainUID);
953-
content = content.replaceAll("@OPERATOR_NS@", operatorNS);
954-
*/
955950
content = content.replaceAll("weblogic-domain", domainNS);
956951
content = content.replaceAll("weblogic-operator", operatorNS);
957952
logger.log(Level.INFO, "to {0}", dst.toString());
@@ -963,8 +958,7 @@ private static void createCrossNSRBACFile(String domainNS, String operatorNS) th
963958
* Remove monitoring exporter directory if exists and clone latest from github for monitoring
964959
* exporter code
965960
*
966-
* @throws Exception if could not run the command successfully to clone of docker-images sample
967-
* from github
961+
* @throws Exception if could not run the command successfully to clone from github
968962
*/
969963
public static void gitCloneBuildMonitoringExporter() throws Exception {
970964
monitoringDir = BaseTest.getResultDir() + "/monitoring";
@@ -989,7 +983,7 @@ public static void gitCloneBuildMonitoringExporter() throws Exception {
989983
removeAndClone.append("rm -rf ").append(monitoringExporterSrcDir).append(" && ");
990984
}
991985
logger.info(" Cloning and building Weblogic Server Monitoring Exporter application");
992-
// git clone docker-images project
986+
// git clone exporter project
993987
removeAndClone
994988
.append(" git clone https://github.com/oracle/weblogic-monitoring-exporter.git ")
995989
.append(monitoringExporterSrcDir);

0 commit comments

Comments
 (0)