Skip to content

Commit ee434a8

Browse files
committed
replaced hardcoded values for wls user and password
1 parent 4010abc commit ee434a8

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

integration-tests/src/test/java/oracle/kubernetes/operator/ItMonitoringExporter.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public class ItMonitoringExporter extends BaseTest {
5555
private static String exporterUrl = "";
5656
private static String configPath = "";
5757
private static String prometheusPort = "32000";
58+
private static String wlsUser = "";
59+
private static String wlsPassword = "";
5860
// "heap_free_current{name="managed-server1"}[15s]" search for results for last 15secs
5961
private static String prometheusSearchKey1 =
6062
"heap_free_current%7Bname%3D%22managed-server1%22%7D%5B15s%5D";
@@ -87,6 +89,8 @@ public static void staticPrepare() throws Exception {
8789
domain = createVerifyDomain(number, operator);
8890
Assert.assertNotNull(domain);
8991
}
92+
wlsUser = BaseTest.getUsername();
93+
wlsPassword = BaseTest.getPassword();
9094
myhost = domain.getHostNameForCurl();
9195
exporterUrl = "http://" + myhost + ":" + domain.getLoadBalancerWebPort() + "/wls-exporter/";
9296
metricsUrl = exporterUrl + "metrics";
@@ -732,7 +736,7 @@ public void test15_ChangeConfigInvalidUser() throws Exception {
732736
configPath + "/rest_snakecasetrue.yml",
733737
"401 Unauthorized for " + exporterUrl,
734738
"invaliduser",
735-
"welcome1");
739+
wlsPassword);
736740
logger.info("SUCCESS - " + testMethodName);
737741
}
738742

@@ -750,7 +754,7 @@ public void test16_ChangeConfigInvalidPass() throws Exception {
750754
"replace",
751755
configPath + "/rest_snakecasetrue.yml",
752756
"401 Unauthorized for " + exporterUrl,
753-
"weblogic",
757+
wlsUser,
754758
"invalidpass");
755759
}
756760

@@ -769,7 +773,7 @@ public void test17_ChangeConfigEmptyUser() throws Exception {
769773
configPath + "/rest_snakecasetrue.yml",
770774
"401 Unauthorized for " + exporterUrl,
771775
"",
772-
"welcome1");
776+
wlsPassword);
773777
logger.info("SUCCESS - " + testMethodName);
774778
}
775779

@@ -787,7 +791,7 @@ public void test18_ChangeConfigEmptyPass() throws Exception {
787791
"replace",
788792
configPath + "/rest_snakecasetrue.yml",
789793
"401 Unauthorized for " + exporterUrl,
790-
"weblogic",
794+
wlsUser,
791795
"");
792796
logger.info("SUCCESS - " + testMethodName);
793797
}
@@ -1050,13 +1054,13 @@ private static void createWLSImageAndDeploy() throws Exception {
10501054
String command =
10511055
"cd "
10521056
+ monitoringExporterEndToEndDir
1053-
+ "/demo-domains/domainBuilder/ && ./build.sh domain1 weblogic welcome1 wluser1 wlpwd123";
1057+
+ "/demo-domains/domainBuilder/ && ./build.sh domain1 " + wlsUser + " " + wlsPassword + " wluser1 wlpwd123";
10541058
TestUtils.exec(command);
10551059
String newImage = "domain1-image:1.0";
10561060
command =
10571061
"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;
10601064
TestUtils.exec(command);
10611065
// apply new domain yaml and verify pod restart
10621066
String crdCmd =
@@ -1074,11 +1078,11 @@ private static void createWLSImageAndDeploy() throws Exception {
10741078
TestUtils.checkPodReady("curl", "default");
10751079
// access metrics
10761080
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";
10781082
ExecResult result = TestUtils.exec(crdCmd);
10791083
assertTrue((result.stdout().contains("wls_servlet_execution_time_average")));
10801084
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";
10821086
result = TestUtils.exec(crdCmd);
10831087
assertTrue((result.stdout().contains("wls_servlet_execution_time_average")));
10841088
}

0 commit comments

Comments
 (0)