@@ -197,8 +197,13 @@ public void test03_AppendConfiguration() throws Exception {
197
197
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
198
198
logTestBegin (testMethodName );
199
199
boolean testCompletedSuccessfully = false ;
200
+ // scale cluster to 1 managed server only to test functionality of the exporter without
201
+ // coordinator layer
202
+ scaleCluster (1 );
203
+
200
204
// make sure some config is there
201
205
HtmlPage page = submitConfigureForm (exporterUrl , "replace" , configPath + "/rest_jvm.yml" );
206
+
202
207
assertTrue (page .asText ().contains ("JVMRuntime" ));
203
208
assertFalse (page .asText ().contains ("WebAppComponentRuntime" ));
204
209
// run append
@@ -228,6 +233,8 @@ public void test04_ReplaceOneAttributeValueAsArrayConfiguration() throws Excepti
228
233
logTestBegin (testMethodName );
229
234
boolean testCompletedSuccessfully = false ;
230
235
236
+ resetMonitoringExporterToPreBuiltConfig ();
237
+
231
238
HtmlPage page =
232
239
submitConfigureForm (exporterUrl , "replace" , configPath + "/rest_oneattribval.yml" );
233
240
assertTrue (page .asText ().contains ("values: invocationTotalCount" ));
@@ -249,6 +256,7 @@ public void test05_AppendArrayWithOneExistedAndOneDifferentAttributeValueAsArray
249
256
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
250
257
logTestBegin (testMethodName );
251
258
boolean testCompletedSuccessfully = false ;
259
+ resetMonitoringExporterToPreBuiltConfig ();
252
260
HtmlPage page =
253
261
submitConfigureForm (exporterUrl , "replace" , configPath + "/rest_oneattribval.yml" );
254
262
assertTrue (page .asText ().contains ("values: invocationTotalCount" ));
@@ -269,6 +277,7 @@ public void test06_ReplaceWithEmptyConfiguration() throws Exception {
269
277
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
270
278
logTestBegin (testMethodName );
271
279
boolean testCompletedSuccessfully = false ;
280
+ resetMonitoringExporterToPreBuiltConfig ();
272
281
HtmlPage page = submitConfigureForm (exporterUrl , "replace" , configPath + "/rest_empty.yml" );
273
282
assertTrue (page .asText ().contains ("queries:" ) && !page .asText ().contains ("values" ));
274
283
testCompletedSuccessfully = true ;
@@ -286,6 +295,7 @@ public void test07_AppendWithEmptyConfiguration() throws Exception {
286
295
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
287
296
logTestBegin (testMethodName );
288
297
boolean testCompletedSuccessfully = false ;
298
+ resetMonitoringExporterToPreBuiltConfig ();
289
299
final WebClient webClient = new WebClient ();
290
300
HtmlPage originalPage = webClient .getPage (exporterUrl );
291
301
assertNotNull (originalPage );
@@ -306,6 +316,7 @@ public void test08_1AppendWithNotYmlConfiguration() throws Exception {
306
316
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
307
317
logTestBegin (testMethodName );
308
318
boolean testCompletedSuccessfully = false ;
319
+ resetMonitoringExporterToPreBuiltConfig ();
309
320
changeConfigNegative (
310
321
"append" , configPath + "/rest_notymlformat.yml" , "Configuration is not in YAML format" );
311
322
testCompletedSuccessfully = true ;
@@ -323,6 +334,7 @@ public void test08_2ReplaceWithNotYmlConfiguration() throws Exception {
323
334
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
324
335
logTestBegin (testMethodName );
325
336
boolean testCompletedSuccessfully = false ;
337
+ resetMonitoringExporterToPreBuiltConfig ();
326
338
changeConfigNegative (
327
339
"replace" , configPath + "/rest_notymlformat.yml" , "Configuration is not in YAML format" );
328
340
}
@@ -358,6 +370,7 @@ public void test10_ReplaceWithCorruptedYmlConfiguration() throws Exception {
358
370
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
359
371
logTestBegin (testMethodName );
360
372
boolean testCompletedSuccessfully = false ;
373
+ resetMonitoringExporterToPreBuiltConfig ();
361
374
changeConfigNegative (
362
375
"replace" ,
363
376
configPath + "/rest_notyml.yml" ,
@@ -377,6 +390,7 @@ public void test11_ReplaceWithDublicatedValuesConfiguration() throws Exception {
377
390
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
378
391
logTestBegin (testMethodName );
379
392
boolean testCompletedSuccessfully = false ;
393
+ resetMonitoringExporterToPreBuiltConfig ();
380
394
changeConfigNegative (
381
395
"replace" ,
382
396
configPath + "/rest_dublicatedval.yml" ,
@@ -396,6 +410,7 @@ public void test12_AppendWithDublicatedValuesConfiguration() throws Exception {
396
410
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
397
411
logTestBegin (testMethodName );
398
412
boolean testCompletedSuccessfully = false ;
413
+ resetMonitoringExporterToPreBuiltConfig ();
399
414
changeConfigNegative (
400
415
"append" ,
401
416
configPath + "/rest_dublicatedval.yml" ,
@@ -416,6 +431,7 @@ public void test13_ReplaceMetricsNameSnakeCaseFalseConfiguration() throws Except
416
431
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
417
432
logTestBegin (testMethodName );
418
433
boolean testCompletedSuccessfully = false ;
434
+ resetMonitoringExporterToPreBuiltConfig ();
419
435
final WebClient webClient = new WebClient ();
420
436
HtmlPage originalPage = webClient .getPage (exporterUrl );
421
437
assertNotNull (originalPage );
@@ -608,6 +624,8 @@ private HtmlPage submitConfigureForm(
608
624
HtmlPage page2 = button .click ();
609
625
assertNotNull (page2 );
610
626
assertFalse ((page2 .asText ()).contains ("Error 500--Internal Server Error" ));
627
+ // wait time for coordinator to update both managed configuration
628
+ Thread .sleep (15 * 1000 );
611
629
return page2 ;
612
630
}
613
631
@@ -643,7 +661,8 @@ private static void gitCloneBuildMonitoringExporter() throws Exception {
643
661
logger .info (" Cloning and building Weblogic Server Monitoring Exporter application" );
644
662
// git clone exporter project
645
663
removeAndClone
646
- .append (" git clone https://github.com/oracle/weblogic-monitoring-exporter.git " )
664
+ .append (
665
+ " git clone -b load-balancer https://github.com/oracle/weblogic-monitoring-exporter.git " )
647
666
.append (monitoringExporterSrcDir );
648
667
TestUtils .exec (removeAndClone .toString ());
649
668
}
@@ -721,6 +740,21 @@ private static void deployMonitoringExporterPrometethusGrafana(
721
740
"wlsexporter" , exporterAppPath , BaseTest .getUsername (), BaseTest .getPassword ());
722
741
}
723
742
743
+ private static void redeployMonitoringExporter (Domain domain ) throws Exception {
744
+ String exporterAppPath = monitoringExporterDir + "/apps/monitoringexporter/wls-exporter.war" ;
745
+
746
+ domain .undeployWebAppViaREST (
747
+ "wlsexporter" , exporterAppPath , BaseTest .getUsername (), BaseTest .getPassword ());
748
+ domain .deployWebAppViaREST (
749
+ "wlsexporter" , exporterAppPath , BaseTest .getUsername (), BaseTest .getPassword ());
750
+ // check if exporter is up
751
+ domain .callWebAppAndVerifyLoadBalancing ("wls-exporter" , false );
752
+ }
753
+
754
+ private static void resetMonitoringExporterToPreBuiltConfig () throws Exception {
755
+ redeployMonitoringExporter (domain );
756
+ }
757
+
724
758
private static void deletePrometheusGrafana () throws Exception {
725
759
726
760
String samplesDir = monitoringExporterDir + "/src/samples/kubernetes/" ;
@@ -846,6 +880,17 @@ private static void upgradeTraefikHostName() throws Exception {
846
880
TestUtils .exec (cmd .toString ());
847
881
}
848
882
883
+ /**
884
+ * call operator to scale to specified number of replicas
885
+ *
886
+ * @param replicas - number of managed servers
887
+ * @throws Exception
888
+ */
889
+ private void scaleCluster (int replicas ) throws Exception {
890
+ logger .info ("Scale up/down to " + replicas + " managed servers" );
891
+ operator .scale (domain .getDomainUid (), domain .getClusterName (), replicas );
892
+ }
893
+
849
894
/**
850
895
* call webapp and verify load balancing by checking server name in the response
851
896
*
0 commit comments