@@ -192,13 +192,15 @@ class ItMonitoringExporter {
192
192
private static String domain5Namespace = null ;
193
193
private static String domain6Namespace = null ;
194
194
private static String domain7Namespace = null ;
195
+ private static String domain8Namespace = null ;
195
196
private static String domain1Uid = "monexp-domain-1" ;
196
197
private static String domain2Uid = "monexp-domain-2" ;
197
198
private static String domain3Uid = "monexp-domain-3" ;
198
199
private static String domain4Uid = "monexp-domain-4" ;
199
200
private static String domain5Uid = "monexp-domain-5" ;
200
201
private static String domain6Uid = "monexp-domain-6" ;
201
202
private static String domain7Uid = "monexp-domain-7" ;
203
+ private static String domain8Uid = "monexp-domain-8" ;
202
204
private static HelmParams nginxHelmParams = null ;
203
205
private static int nodeportshttp = 0 ;
204
206
private static int nodeportshttps = 0 ;
@@ -247,7 +249,7 @@ class ItMonitoringExporter {
247
249
*/
248
250
@ BeforeAll
249
251
250
- public static void initAll (@ Namespaces (11 ) List <String > namespaces ) {
252
+ public static void initAll (@ Namespaces (12 ) List <String > namespaces ) {
251
253
252
254
logger = getLogger ();
253
255
// create standard, reusable retry/backoff policy
@@ -299,9 +301,13 @@ public static void initAll(@Namespaces(11) List<String> namespaces) {
299
301
assertNotNull (namespaces .get (10 ), "Namespace list is null" );
300
302
domain7Namespace = namespaces .get (10 );
301
303
304
+ logger .info ("Get a unique namespace for domain8" );
305
+ assertNotNull (namespaces .get (11 ), "Namespace list is null" );
306
+ domain8Namespace = namespaces .get (11 );
307
+
302
308
logger .info ("install and verify operator" );
303
309
installAndVerifyOperator (opNamespace , domain1Namespace ,domain2Namespace ,domain3Namespace ,
304
- domain4Namespace ,domain5Namespace , domain6Namespace , domain7Namespace );
310
+ domain4Namespace ,domain5Namespace , domain6Namespace , domain7Namespace , domain8Namespace );
305
311
306
312
logger .info ("install monitoring exporter" );
307
313
installMonitoringExporter ();
@@ -312,7 +318,7 @@ public static void initAll(@Namespaces(11) List<String> namespaces) {
312
318
//buildMonitoringExporterImage("phx.ocir.io/weblogick8s/exporter:beta");
313
319
314
320
logger .info ("create and verify WebLogic domain image using model in image with model files" );
315
- miiImage = createAndVerifyMiiImage (monitoringExporterAppDir );
321
+ miiImage = createAndVerifyMiiImage (monitoringExporterAppDir , MODEL_DIR + "/" + MONEXP_MODEL_FILE );
316
322
317
323
// install and verify NGINX
318
324
nginxHelmParams = installAndVerifyNginx (nginxNamespace , 0 , 0 );
@@ -408,7 +414,7 @@ public void testSideCarBasicFunctionality() throws Exception {
408
414
409
415
// create and verify one cluster mii domain
410
416
logger .info ("Create domain and verify that it's running" );
411
- String miiImage1 = createAndVerifyMiiImage (SESSMIGR_APP_NAME , MODEL_DIR + "/model.sessmigr.yaml" );
417
+ String miiImage1 = createAndVerifyMiiImage (MODEL_DIR + "/model.sessmigr.yaml" );
412
418
String yaml = RESOURCE_DIR + "/exporter/rest_webapp.yaml" ;
413
419
createAndVerifyDomain (miiImage1 , domain7Uid , domain7Namespace , "FromModel" , 2 , false , yaml );
414
420
installPrometheusGrafana (PROMETHEUS_CHART_VERSION , GRAFANA_CHART_VERSION ,
@@ -497,7 +503,7 @@ public void testSideCarBasicFunctionalityTwoClusters() throws Exception {
497
503
498
504
// create and verify one cluster mii domain
499
505
logger .info ("Create domain and verify that it's running" );
500
- String miiImage1 = createAndVerifyMiiImage (SESSMIGR_APP_NAME , MODEL_DIR + "/model.sessmigr.2clusters.yaml" );
506
+ String miiImage1 = createAndVerifyMiiImage (MODEL_DIR + "/model.sessmigr.2clusters.yaml" );
501
507
String yaml = RESOURCE_DIR + "/exporter/rest_jvm.yaml" ;
502
508
createAndVerifyDomain (miiImage1 , domain5Uid , domain5Namespace , "FromModel" , 2 , true , yaml );
503
509
installPrometheusGrafana (PROMETHEUS_CHART_VERSION , GRAFANA_CHART_VERSION ,
@@ -526,7 +532,7 @@ public void testSideCarBasicFunctionalityWithSSL() throws Exception {
526
532
// create and verify one cluster mii domain
527
533
logger .info ("Create domain and verify that it's running" );
528
534
String yaml = RESOURCE_DIR + "/exporter/rest_webapp.yaml" ;
529
- String miiImage1 = createAndVerifyMiiImage (SESSMIGR_APP_NAME , MODEL_DIR + "/model.ssl.yaml" );
535
+ String miiImage1 = createAndVerifyMiiImage (MODEL_DIR + "/model.ssl.yaml" );
530
536
createAndVerifyDomain (miiImage1 , domain6Uid , domain6Namespace , "FromModel" , 2 , false , yaml );
531
537
installPrometheusGrafana (PROMETHEUS_CHART_VERSION , GRAFANA_CHART_VERSION ,
532
538
domain6Namespace ,
@@ -606,6 +612,39 @@ public void testBasicFunctionality() throws Exception {
606
612
replaceMetricsNoRestPortConfiguration ();
607
613
}
608
614
615
+
616
+ /**
617
+ * Test covers scenario when admin port enabled .
618
+ * Create Model in Image with admin port and ssl enabled.
619
+ * Check generated monitoring exporter WebLogic metrics via https request.
620
+ */
621
+ //commented out untill Issue (see oracle/weblogic-monitoring-exporter#138) will be fixed
622
+ //@Test
623
+ @ DisplayName ("Test Accesability of Monitoring Exporter dashboard and metrics if admin port is enabled." )
624
+ public void testAdminPortEnabled () throws Exception {
625
+
626
+ // create and verify one cluster mii domain with admin port enabled
627
+ logger .info ("Create domain and verify that it's running" );
628
+ String miiImage1 = createAndVerifyMiiImage (monitoringExporterAppDir , MODEL_DIR + "/model-adminportenabled.yaml" );
629
+ createAndVerifyDomain (miiImage1 , domain8Uid , domain8Namespace , "FromModel" , 2 , false );
630
+ logger .info ("checking access to wls metrics via https connection" );
631
+
632
+ assertTrue (verifyMonExpAppAccess ("wls-exporter" ,
633
+ "type: WebAppComponentRuntime" ,
634
+ domain8Uid ,
635
+ domain8Namespace ,
636
+ true , null ),
637
+ "monitoring exporter dashboard page can't be accessed via https" );
638
+
639
+ assertTrue (verifyMonExpAppAccess ("wls-exporter/metrics" ,
640
+ "wls_servlet_invocation_total_count" ,
641
+ domain8Uid ,
642
+ domain8Namespace ,
643
+ true , null ),
644
+ "monitoring exporter metrics page can't be accessed via https" );
645
+
646
+ }
647
+
609
648
/**
610
649
* Verify access to monitoring exporter WebLogic metrics via https.
611
650
*/
@@ -617,7 +656,8 @@ public void testAccessExporterViaHttps() throws Exception {
617
656
try {
618
657
logger .info ("create and verify WebLogic domain image using model in image with model files for norestport" );
619
658
620
- miiImage1 = createAndVerifyMiiImage (monitoringExporterAppDir + "/norestport" );
659
+ miiImage1 = createAndVerifyMiiImage (monitoringExporterAppDir + "/norestport" ,
660
+ MODEL_DIR + "/" + MONEXP_MODEL_FILE );
621
661
622
662
// create and verify one cluster mii domain
623
663
logger .info ("Create domain and verify that it's running" );
@@ -1509,14 +1549,14 @@ private static void deleteMonitoringExporterTempDir() {
1509
1549
1510
1550
1511
1551
/**
1512
- * Create mii image.
1552
+ * Create mii image with SESSMIGR application .
1513
1553
*/
1514
- private static String createAndVerifyMiiImage (String appName , String modelFile ) {
1554
+ private static String createAndVerifyMiiImage (String modelFile ) {
1515
1555
// create image with model files
1516
1556
logger .info ("Create image with model file and verify" );
1517
1557
1518
1558
List <String > appList = new ArrayList ();
1519
- appList .add (appName );
1559
+ appList .add (SESSMIGR_APP_NAME );
1520
1560
1521
1561
// build the model file list
1522
1562
final List <String > modelList = Collections .singletonList (modelFile );
@@ -1532,7 +1572,7 @@ private static String createAndVerifyMiiImage(String appName, String modelFile)
1532
1572
/**
1533
1573
* Create mii image with monitoring exporter webapp.
1534
1574
*/
1535
- private static String createAndVerifyMiiImage (String monexpAppDir ) {
1575
+ private static String createAndVerifyMiiImage (String monexpAppDir , String modelFilePath ) {
1536
1576
// create image with model files
1537
1577
logger .info ("Create image with model file with monitoring exporter app and verify" );
1538
1578
String appPath = String .format ("%s/wls-exporter.war" , monexpAppDir );
@@ -1541,7 +1581,7 @@ private static String createAndVerifyMiiImage(String monexpAppDir) {
1541
1581
appList .add (SESSMIGR_APP_NAME );
1542
1582
1543
1583
// build the model file list
1544
- final List <String > modelList = Collections .singletonList (MODEL_DIR + "/" + MONEXP_MODEL_FILE );
1584
+ final List <String > modelList = Collections .singletonList (modelFilePath );
1545
1585
String myImage =
1546
1586
createMiiImageAndVerify (MONEXP_IMAGE_NAME , modelList , appList );
1547
1587
@@ -1815,13 +1855,17 @@ private boolean verifyMonExpAppAccess(String uri, String searchKey, String domai
1815
1855
protocol = "https" ;
1816
1856
port = "8100" ;
1817
1857
}
1858
+ String podName = domainUid + "-" + clusterName + "-managed-server1" ;
1859
+ if (clusterName == null ) {
1860
+ podName = domainUid + "-managed-server1" ;
1861
+ }
1818
1862
// access metrics
1819
1863
final String command = String .format (
1820
- "kubectl exec -n " + domainNS + " " + domainUid + "-" + clusterName + "-managed-server1 -- curl -k %s://"
1864
+ "kubectl exec -n " + domainNS + " " + podName + " -- curl -k %s://"
1821
1865
+ ADMIN_USERNAME_DEFAULT
1822
1866
+ ":"
1823
1867
+ ADMIN_PASSWORD_DEFAULT
1824
- + "@" + domainUid + "-" + clusterName + "-managed-server1 :%s/%s" , protocol , port , uri );
1868
+ + "@" + podName + ":%s/%s" , protocol , port , uri );
1825
1869
logger .info ("accessing managed server exporter via " + command );
1826
1870
1827
1871
boolean isFound = false ;
0 commit comments