@@ -809,9 +809,13 @@ public void test19_EndToEndViaChart() throws Exception {
809
809
domain .destroy ();
810
810
domain = null ;
811
811
}
812
- tearDown (new Object () {}.getClass ().getEnclosingClass ().getSimpleName ());
813
812
gitCloneMonitoringExporter ();
814
- setupPVMYSQL ();
813
+ try {
814
+ setupPVMYSQL ();
815
+ } catch (Exception ex ) {
816
+ deletePvDir ();
817
+ throw new RuntimeException ("FAILURE: failed to install database " );
818
+ }
815
819
createWLSImageAndDeploy ();
816
820
installPrometheusGrafanaViaChart ();
817
821
} finally {
@@ -928,10 +932,7 @@ private static void setupPVMYSQL() throws Exception {
928
932
if (new File (pvDir ).exists ()) {
929
933
logger .info (" PV dir already exists , cleaning " );
930
934
if (!pvDir .isEmpty ()) {
931
- StringBuffer removeDir = new StringBuffer ();
932
- logger .info ("Cleaning PV dir " + pvDir );
933
-
934
- removeDir .append ("rm -rf " ).append (pvDir ).append (" && " );
935
+ deletePvDir ();
935
936
}
936
937
} else {
937
938
Files .createDirectories (Paths .get (pvDir ));
@@ -943,8 +944,12 @@ private static void setupPVMYSQL() throws Exception {
943
944
replaceStringInFile (
944
945
monitoringExporterEndToEndDir + "/grafana/persistence.yaml" , "%PV_ROOT%" , pvDir );
945
946
// deploy PV and PVC
946
- String crdCmd =
947
- " kubectl apply -f " + monitoringExporterEndToEndDir + "/mysql/persistence.yaml" ;
947
+ // clean mysql processes
948
+ String crdCmd = "sudo pkill mysql" ;
949
+ ExecCommand .exec ("crdCmd" );
950
+ crdCmd = "sudo pkill mysqlp" ;
951
+ ExecCommand .exec ("crdCmd" );
952
+ crdCmd = " kubectl apply -f " + monitoringExporterEndToEndDir + "/mysql/persistence.yaml" ;
948
953
TestUtils .exec (crdCmd );
949
954
crdCmd = " kubectl apply -f " + monitoringExporterEndToEndDir + "/mysql/mysql.yaml" ;
950
955
TestUtils .exec (crdCmd );
@@ -1010,6 +1015,7 @@ private static void setupPVMYSQL() throws Exception {
1010
1015
+ result .stdout ());
1011
1016
}
1012
1017
}
1018
+
1013
1019
/**
1014
1020
* Install wls image tool and update wls pods
1015
1021
*
@@ -1040,12 +1046,7 @@ private static void createWLSImageAndDeploy() throws Exception {
1040
1046
TestUtils .checkPodReady ("domain1-admin-server" , "default" );
1041
1047
TestUtils .checkPodReady ("domain1-managed-server-1" , "default" );
1042
1048
TestUtils .checkPodReady ("domain1-managed-server-2" , "default" );
1043
- /*
1044
- domain.verifyDomainServerPodRestart(
1045
- "\"" + getWeblogicImageName() + ":" + getWeblogicImageTag() + "\""
1046
- "\"" + newImage + "\"");
1047
1049
1048
- */
1049
1050
// apply curl to the pod
1050
1051
crdCmd = " kubectl apply -f " + monitoringExporterEndToEndDir + "/util/curl.yaml" ;
1051
1052
TestUtils .exec (crdCmd );
@@ -1160,13 +1161,29 @@ private static void uninstallMySQL() throws Exception {
1160
1161
1161
1162
crdCmd = " kubectl delete -f " + monitoringExporterEndToEndDir + "mysql/persistence.yaml" ;
1162
1163
ExecCommand .exec (crdCmd );
1163
- crdCmd =
1164
+ deletePvDir ();
1165
+ }
1166
+
1167
+ /**
1168
+ * Delete PvDir via docker
1169
+ *
1170
+ * @throws Exception if could not run the command successfully to clone from github
1171
+ */
1172
+ private static void deletePvDir () throws Exception {
1173
+ String monitoringExporterEndToEndDir =
1174
+ monitoringExporterDir + "/src/samples/kubernetes/end2end/" ;
1175
+ String pvDir = monitoringExporterEndToEndDir + "pvDir" ;
1176
+ String crdCmd =
1164
1177
"cd "
1165
1178
+ monitoringExporterEndToEndDir
1166
1179
+ " && docker run --rm -v "
1167
1180
+ monitoringExporterEndToEndDir
1168
1181
+ "pvDir:/tt -v $PWD/util:/util nginx /util/clean-pv.sh" ;
1169
1182
ExecCommand .exec (crdCmd );
1183
+ StringBuffer removeDir = new StringBuffer ();
1184
+ logger .info ("Cleaning PV dir " + pvDir );
1185
+
1186
+ removeDir .append ("rm -rf " ).append (pvDir ).append (" && " );
1170
1187
}
1171
1188
1172
1189
/**
0 commit comments