4
4
5
5
package oracle .kubernetes .operator ;
6
6
7
- import static org .junit .Assert .assertFalse ;
8
- import static org .junit .Assert .assertNotNull ;
9
- import static org .junit .Assert .assertTrue ;
10
-
11
- import com .gargoylesoftware .htmlunit .FailingHttpStatusCodeException ;
12
- import com .gargoylesoftware .htmlunit .WebClient ;
13
- import com .gargoylesoftware .htmlunit .html .HtmlFileInput ;
14
- import com .gargoylesoftware .htmlunit .html .HtmlForm ;
15
- import com .gargoylesoftware .htmlunit .html .HtmlPage ;
16
- import com .gargoylesoftware .htmlunit .html .HtmlRadioButtonInput ;
17
- import com .gargoylesoftware .htmlunit .html .HtmlSubmitInput ;
18
7
import java .io .File ;
19
8
import java .io .IOException ;
20
9
import java .nio .charset .Charset ;
26
15
import java .util .Map ;
27
16
import java .util .logging .Level ;
28
17
import javax .xml .bind .DatatypeConverter ;
18
+
19
+ import com .gargoylesoftware .htmlunit .FailingHttpStatusCodeException ;
20
+ import com .gargoylesoftware .htmlunit .WebClient ;
21
+ import com .gargoylesoftware .htmlunit .html .HtmlFileInput ;
22
+ import com .gargoylesoftware .htmlunit .html .HtmlForm ;
23
+ import com .gargoylesoftware .htmlunit .html .HtmlPage ;
24
+ import com .gargoylesoftware .htmlunit .html .HtmlRadioButtonInput ;
25
+ import com .gargoylesoftware .htmlunit .html .HtmlSubmitInput ;
29
26
import oracle .kubernetes .operator .utils .Domain ;
30
27
import oracle .kubernetes .operator .utils .ExecCommand ;
31
28
import oracle .kubernetes .operator .utils .ExecResult ;
39
36
import org .junit .Test ;
40
37
import org .junit .runners .MethodSorters ;
41
38
39
+ import static org .junit .Assert .assertFalse ;
40
+ import static org .junit .Assert .assertNotNull ;
41
+ import static org .junit .Assert .assertTrue ;
42
+
42
43
/** This test is used for testing Monitoring Exporter with Operator(s) . */
43
44
@ FixMethodOrder (MethodSorters .NAME_ASCENDING )
44
45
public class ItMonitoringExporter extends BaseTest {
@@ -797,7 +798,7 @@ public void test18_ChangeConfigEmptyPass() throws Exception {
797
798
}
798
799
799
800
/**
800
- * Test End to End example from MonitoringExporter github project
801
+ * Test End to End example from MonitoringExporter github project.
801
802
*
802
803
* @throws Exception if test fails
803
804
*/
@@ -814,12 +815,12 @@ public void test19_EndToEndViaChart() throws Exception {
814
815
}
815
816
gitCloneMonitoringExporter ();
816
817
try {
817
- setupPVMYSQL ();
818
+ setupPvMysql ();
818
819
} catch (Exception ex ) {
819
820
deletePvDir ();
820
821
throw new RuntimeException ("FAILURE: failed to install database " );
821
822
}
822
- createWLSImageAndDeploy ();
823
+ createWlsImageAndDeploy ();
823
824
installWebHookAndAlertManager ();
824
825
installPrometheusGrafanaViaChart ();
825
826
fireAlert ();
@@ -860,7 +861,7 @@ private void fireAlert() throws Exception {
860
861
String command = "kubectl -n webhook logs " + webhookPod ;
861
862
ExecResult webhookResult = TestUtils .exec (command );
862
863
logger .info (" webhook log " + webhookResult .stdout ());
863
- assertTrue ( webhookResult .stdout ().contains ("Some WLS cluster has only one running server for more than 1 minutes" ));
864
+ assertTrue (webhookResult .stdout ().contains ("Some WLS cluster has only one running server for more than 1 minutes" ));
864
865
}
865
866
866
867
private static String getPodName (String app , String namespace ) throws Exception {
@@ -954,11 +955,11 @@ private HtmlPage submitConfigureForm(
954
955
955
956
/**
956
957
* Remove monitoring exporter directory if exists and clone latest from github for monitoring
957
- * exporter code
958
+ * exporter code.
958
959
*
959
960
* @throws Exception if could not run the command successfully to install database
960
961
*/
961
- private static void setupPVMYSQL () throws Exception {
962
+ private static void setupPvMysql () throws Exception {
962
963
String pvDir = monitoringExporterEndToEndDir + "pvDir" ;
963
964
if (new File (pvDir ).exists ()) {
964
965
logger .info (" PV dir already exists , cleaning " );
@@ -1044,11 +1045,11 @@ private static void setupPVMYSQL() throws Exception {
1044
1045
}
1045
1046
1046
1047
/**
1047
- * Install wls image tool and update wls pods
1048
+ * Install wls image tool and update wls pods.
1048
1049
*
1049
1050
* @throws Exception if could not run the command successfully to create WLSImage and deploy
1050
1051
*/
1051
- private static void createWLSImageAndDeploy () throws Exception {
1052
+ private static void createWlsImageAndDeploy () throws Exception {
1052
1053
operator1 = TestUtils .createOperator (OPERATOR1_YAML );
1053
1054
1054
1055
String command =
@@ -1088,7 +1089,7 @@ private static void createWLSImageAndDeploy() throws Exception {
1088
1089
}
1089
1090
1090
1091
/**
1091
- * Install Prometheus and Grafana using helm chart
1092
+ * Install Prometheus and Grafana using helm chart.
1092
1093
*
1093
1094
* @throws Exception if could not run the command successfully to install Prometheus and Grafana
1094
1095
*/
@@ -1114,7 +1115,8 @@ private static void installPrometheusGrafanaViaChart() throws Exception {
1114
1115
crdCmd = "kubectl apply -f " + monitoringExporterEndToEndDir + "/grafana/persistence.yaml" ;
1115
1116
TestUtils .exec (crdCmd );
1116
1117
crdCmd =
1117
- "kubectl --namespace monitoring create secret generic grafana-secret --from-literal=username=admin --from-literal=password=12345678" ;
1118
+ "kubectl --namespace monitoring create secret generic grafana-secret"
1119
+ + " --from-literal=username=admin --from-literal=password=12345678" ;
1118
1120
TestUtils .exec (crdCmd );
1119
1121
logger .info ("calling helm install for grafana" );
1120
1122
crdCmd =
@@ -1147,7 +1149,7 @@ private static void installPrometheusGrafanaViaChart() throws Exception {
1147
1149
}
1148
1150
1149
1151
/**
1150
- * Install Prometheus and Grafana using helm chart
1152
+ * Install Prometheus and Grafana using helm chart.
1151
1153
*
1152
1154
* @throws Exception if could not run the command successfully to install webhook and alert manager
1153
1155
*/
@@ -1170,7 +1172,7 @@ private static void installWebHookAndAlertManager() throws Exception {
1170
1172
}
1171
1173
1172
1174
/**
1173
- * Uninstall Prometheus and Grafana using helm chart
1175
+ * Uninstall Prometheus and Grafana using helm chart.
1174
1176
*
1175
1177
* @throws Exception if could not run the command successfully to uninstall deployments
1176
1178
*/
@@ -1207,7 +1209,7 @@ private static void uninstallWebHookPrometheusGrafanaViaChart() throws Exception
1207
1209
}
1208
1210
1209
1211
/**
1210
- * Unnstall MYSQL
1212
+ * Uninstall MYSQL.
1211
1213
*
1212
1214
* @throws Exception if could not run the command successfully to uninstall MySQL
1213
1215
*/
@@ -1226,7 +1228,7 @@ private static void uninstallMySQL() throws Exception {
1226
1228
}
1227
1229
1228
1230
/**
1229
- * Delete PvDir via docker
1231
+ * Delete PvDir via docker.
1230
1232
*
1231
1233
* @throws Exception if could not run the command successfully to delete PV
1232
1234
*/
@@ -1246,7 +1248,7 @@ private static void deletePvDir() throws Exception {
1246
1248
}
1247
1249
1248
1250
/**
1249
- * A utility method to sed files
1251
+ * A utility method to sed files.
1250
1252
*
1251
1253
* @throws IOException when copying files from source location to staging area fails
1252
1254
*/
@@ -1263,7 +1265,7 @@ private static void replaceStringInFile(String filePath, String oldValue, String
1263
1265
1264
1266
/**
1265
1267
* A utility method to copy Cross Namespaces RBAC yaml template file replacing the DOMAIN_NS,
1266
- * OPERATOR_NS
1268
+ * OPERATOR_NS.
1267
1269
*
1268
1270
* @throws IOException when copying files from source location to staging area fails
1269
1271
*/
@@ -1283,7 +1285,7 @@ private static void createCrossNSRBACFile(String domainNS, String operatorNS) th
1283
1285
}
1284
1286
1285
1287
/**
1286
- * call operator to scale to specified number of replicas
1288
+ * call operator to scale to specified number of replicas.
1287
1289
*
1288
1290
* @param replicas - number of managed servers
1289
1291
* @throws Exception if scaling fails
0 commit comments