@@ -55,6 +55,8 @@ public class ItMonitoringExporter extends BaseTest {
55
55
private static String exporterUrl = "" ;
56
56
private static String configPath = "" ;
57
57
private static String prometheusPort = "32000" ;
58
+ private static String wlsUser = "" ;
59
+ private static String wlsPassword = "" ;
58
60
// "heap_free_current{name="managed-server1"}[15s]" search for results for last 15secs
59
61
private static String prometheusSearchKey1 =
60
62
"heap_free_current%7Bname%3D%22managed-server1%22%7D%5B15s%5D" ;
@@ -87,6 +89,8 @@ public static void staticPrepare() throws Exception {
87
89
domain = createVerifyDomain (number , operator );
88
90
Assert .assertNotNull (domain );
89
91
}
92
+ wlsUser = BaseTest .getUsername ();
93
+ wlsPassword = BaseTest .getPassword ();
90
94
myhost = domain .getHostNameForCurl ();
91
95
exporterUrl = "http://" + myhost + ":" + domain .getLoadBalancerWebPort () + "/wls-exporter/" ;
92
96
metricsUrl = exporterUrl + "metrics" ;
@@ -732,7 +736,7 @@ public void test15_ChangeConfigInvalidUser() throws Exception {
732
736
configPath + "/rest_snakecasetrue.yml" ,
733
737
"401 Unauthorized for " + exporterUrl ,
734
738
"invaliduser" ,
735
- "welcome1" );
739
+ wlsPassword );
736
740
logger .info ("SUCCESS - " + testMethodName );
737
741
}
738
742
@@ -750,7 +754,7 @@ public void test16_ChangeConfigInvalidPass() throws Exception {
750
754
"replace" ,
751
755
configPath + "/rest_snakecasetrue.yml" ,
752
756
"401 Unauthorized for " + exporterUrl ,
753
- "weblogic" ,
757
+ wlsUser ,
754
758
"invalidpass" );
755
759
}
756
760
@@ -769,7 +773,7 @@ public void test17_ChangeConfigEmptyUser() throws Exception {
769
773
configPath + "/rest_snakecasetrue.yml" ,
770
774
"401 Unauthorized for " + exporterUrl ,
771
775
"" ,
772
- "welcome1" );
776
+ wlsPassword );
773
777
logger .info ("SUCCESS - " + testMethodName );
774
778
}
775
779
@@ -787,7 +791,7 @@ public void test18_ChangeConfigEmptyPass() throws Exception {
787
791
"replace" ,
788
792
configPath + "/rest_snakecasetrue.yml" ,
789
793
"401 Unauthorized for " + exporterUrl ,
790
- "weblogic" ,
794
+ wlsUser ,
791
795
"" );
792
796
logger .info ("SUCCESS - " + testMethodName );
793
797
}
@@ -1050,13 +1054,13 @@ private static void createWLSImageAndDeploy() throws Exception {
1050
1054
String command =
1051
1055
"cd "
1052
1056
+ monitoringExporterEndToEndDir
1053
- + "/demo-domains/domainBuilder/ && ./build.sh domain1 weblogic welcome1 wluser1 wlpwd123" ;
1057
+ + "/demo-domains/domainBuilder/ && ./build.sh domain1 " + wlsUser + " " + wlsPassword + " wluser1 wlpwd123" ;
1054
1058
TestUtils .exec (command );
1055
1059
String newImage = "domain1-image:1.0" ;
1056
1060
command =
1057
1061
"kubectl -n default create secret generic domain1-weblogic-credentials "
1058
- + " --from-literal=username=weblogic "
1059
- + " --from-literal=password=welcome1" ;
1062
+ + " --from-literal=username=" + wlsUser
1063
+ + " --from-literal=password=" + wlsPassword ;
1060
1064
TestUtils .exec (command );
1061
1065
// apply new domain yaml and verify pod restart
1062
1066
String crdCmd =
@@ -1074,11 +1078,11 @@ private static void createWLSImageAndDeploy() throws Exception {
1074
1078
TestUtils .checkPodReady ("curl" , "default" );
1075
1079
// access metrics
1076
1080
crdCmd =
1077
- "kubectl exec curl -- curl http://weblogic:welcome1 @domain1-managed-server-1:8001/wls-exporter/metrics" ;
1081
+ "kubectl exec curl -- curl http://" + wlsUser + ":" + wlsPassword + " @domain1-managed-server-1:8001/wls-exporter/metrics" ;
1078
1082
ExecResult result = TestUtils .exec (crdCmd );
1079
1083
assertTrue ((result .stdout ().contains ("wls_servlet_execution_time_average" )));
1080
1084
crdCmd =
1081
- "kubectl exec curl -- curl http://weblogic:welcome1 @domain1-managed-server-2:8001/wls-exporter/metrics" ;
1085
+ "kubectl exec curl -- curl http://" + wlsUser + ":" + wlsPassword + " @domain1-managed-server-2:8001/wls-exporter/metrics" ;
1082
1086
result = TestUtils .exec (crdCmd );
1083
1087
assertTrue ((result .stdout ().contains ("wls_servlet_execution_time_average" )));
1084
1088
}
0 commit comments