Skip to content

Commit 9dc93a7

Browse files
committed
added cleaning after other tests
1 parent 3905b01 commit 9dc93a7

File tree

1 file changed

+53
-39
lines changed

1 file changed

+53
-39
lines changed

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

Lines changed: 53 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public static void staticUnPrepare() throws Exception {
129129
*
130130
* @throws Exception if could not run the command successfully to clone from github
131131
*/
132-
private static void gitCloneBuildMonitoringExporter() throws Exception {
132+
private static void gitCloneMonitoringExporter() throws Exception {
133133
String monitoringExporterSrcDir = monitoringExporterDir + "/src";
134134
// target dir for monitoring exporter webapp
135135
String monitoringExporterWar =
@@ -159,46 +159,58 @@ private static void gitCloneBuildMonitoringExporter() throws Exception {
159159
.append(monitoringExporterSrcDir);
160160
TestUtils.exec(removeAndClone.toString());
161161
}
162-
163-
// build monitoring exporter project
164-
StringBuffer buildExporter = new StringBuffer();
165-
buildExporter
166-
.append("cd " + monitoringExporterSrcDir)
167-
.append(" && ")
168-
.append(" mvn clean install --log-file output.txt");
169-
TestUtils.exec(buildExporter.toString());
170-
171-
// build monitoring monitoring exporter webapp
172-
StringBuffer buildExporterWar = new StringBuffer();
173-
buildExporterWar
174-
.append("cd " + monitoringExporterSrcDir + "/webapp")
175-
.append(" && ")
176-
.append("mvn package -Dconfiguration=")
177-
.append(resourceExporterDir + "/rest_webapp.yml")
178-
.append(" --log-file output1.txt");
179-
TestUtils.exec(buildExporterWar.toString());
180-
181-
// build coordinator image
182-
StringBuffer buildCoordinatorImage = new StringBuffer();
183-
buildCoordinatorImage
184-
.append("cd " + monitoringExporterSrcDir + "/config_coordinator")
185-
.append(" && ")
186-
.append(" docker build -t config_coordinator . ");
187-
TestUtils.exec(buildCoordinatorImage.toString());
188-
189-
// copy created war file to desired destination
190-
buildExporterWar = new StringBuffer();
191-
buildExporterWar
192-
.append(" mkdir " + monitoringExporterDir + "/apps")
193-
.append(" && mkdir " + monitoringExporterDir + "/apps/monitoringexporter")
194-
.append(" && ")
195-
.append(" cp " + monitoringExporterSrcDir)
196-
.append("/webapp/target/wls-exporter.war ")
197-
.append(monitoringExporterWar);
198-
TestUtils.exec(buildExporterWar.toString());
199162
}
200163
}
201164

165+
/**
166+
* Build monitoring exporter app
167+
*
168+
* @throws Exception if could not run the command successfully to clone from github
169+
*/
170+
private static void buildMonitoringExporter() throws Exception {
171+
String monitoringExporterSrcDir = monitoringExporterDir + "/src";
172+
// target dir for monitoring exporter webapp
173+
String monitoringExporterWar =
174+
monitoringExporterDir + "/apps/monitoringexporter/wls-exporter.war";
175+
176+
// build monitoring exporter project
177+
StringBuffer buildExporter = new StringBuffer();
178+
buildExporter
179+
.append("cd " + monitoringExporterSrcDir)
180+
.append(" && ")
181+
.append(" mvn clean install --log-file output.txt");
182+
TestUtils.exec(buildExporter.toString());
183+
184+
// build monitoring monitoring exporter webapp
185+
StringBuffer buildExporterWar = new StringBuffer();
186+
buildExporterWar
187+
.append("cd " + monitoringExporterSrcDir + "/webapp")
188+
.append(" && ")
189+
.append("mvn package -Dconfiguration=")
190+
.append(resourceExporterDir + "/rest_webapp.yml")
191+
.append(" --log-file output1.txt");
192+
TestUtils.exec(buildExporterWar.toString());
193+
194+
// build coordinator image
195+
StringBuffer buildCoordinatorImage = new StringBuffer();
196+
buildCoordinatorImage
197+
.append("cd " + monitoringExporterSrcDir + "/config_coordinator")
198+
.append(" && ")
199+
.append(" docker build -t config_coordinator . ");
200+
TestUtils.exec(buildCoordinatorImage.toString());
201+
202+
// copy created war file to desired destination
203+
buildExporterWar = new StringBuffer();
204+
buildExporterWar
205+
.append(" mkdir " + monitoringExporterDir + "/apps")
206+
.append(" && mkdir " + monitoringExporterDir + "/apps/monitoringexporter")
207+
.append(" && ")
208+
.append(" cp " + monitoringExporterSrcDir)
209+
.append("/webapp/target/wls-exporter.war ")
210+
.append(monitoringExporterWar);
211+
TestUtils.exec(buildExporterWar.toString());
212+
}
213+
202214
private static void deployMonitoringExporterPrometethusGrafana(
203215
String exporterAppPath, Domain domain, Operator operator) throws Exception {
204216

@@ -315,7 +327,8 @@ private static void createCrossNsRbacFile(String domainNS, String operatorNS) th
315327
*/
316328
private static void deployRunMonitoringExporter(Domain domain, Operator operator)
317329
throws Exception {
318-
gitCloneBuildMonitoringExporter();
330+
gitCloneMonitoringExporter();
331+
buildMonitoringExporter();
319332
logger.info("Creating Operator & waiting for the script to complete execution");
320333
boolean testCompletedSuccessfully = false;
321334
startExporterPrometheusGrafana(domain, operator);
@@ -797,6 +810,7 @@ public void test19_EndToEndViaChart() throws Exception {
797810
domain = null;
798811
}
799812
tearDown(new Object() {}.getClass().getEnclosingClass().getSimpleName());
813+
gitCloneMonitoringExporter();
800814
setupPVMYSQL();
801815
createWLSImageAndDeploy();
802816
installPrometheusGrafanaViaChart();

0 commit comments

Comments
 (0)