Skip to content

Commit f9149b2

Browse files
hzhao-githubrjeberhard
authored andcommitted
Fixed the failure, [wko-nightly] [internal OKE] Failure of ItMiiDynamicUpdatePart1.testMiiUpdateWorkManager
1 parent 5076b71 commit f9149b2

File tree

1 file changed

+42
-38
lines changed

1 file changed

+42
-38
lines changed

integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonMiiTestUtils.java

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,20 +1075,9 @@ public static boolean checkApplicationRuntime(
10751075
private static String readRuntimeResource(String adminSvcExtHost, String domainNamespace,
10761076
String adminServerPodName, String resourcePath, String callerName) {
10771077
LoggingFacade logger = getLogger();
1078-
String result = null;
1079-
String curlString = null;
1080-
if (OKE_CLUSTER_PRIVATEIP) {
1081-
String protocol = "http";
1082-
String port = "7001";
1078+
String returnString = null;
10831079

1084-
curlString = String.format(
1085-
KUBERNETES_CLI + " exec -n " + domainNamespace + " " + adminServerPodName + " -- curl -g -k %s://"
1086-
+ ADMIN_USERNAME_DEFAULT
1087-
+ ":"
1088-
+ ADMIN_PASSWORD_DEFAULT
1089-
+ "@" + adminServerPodName + ":%s/%s", protocol, port, resourcePath);
1090-
curlString = curlString + " --silent --show-error ";
1091-
} else if (TestConstants.KIND_CLUSTER
1080+
if (TestConstants.KIND_CLUSTER
10921081
&& !TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
10931082
int port = getServicePort(domainNamespace, adminServerPodName, "internal-t3");
10941083
String domainName = adminServerPodName.split("-" + ADMIN_SERVER_NAME_BASE)[0];
@@ -1114,36 +1103,51 @@ private static String readRuntimeResource(String adminSvcExtHost, String domainN
11141103
try {
11151104
response = OracleHttpClient.get(url, headers, true);
11161105
assertEquals(200, response.statusCode());
1117-
return response.body();
1106+
returnString = response.body();
11181107
} catch (Exception ex) {
1119-
return null;
1108+
ex.printStackTrace();
11201109
}
1121-
}
1122-
int adminServiceNodePort
1123-
= getServiceNodePort(domainNamespace, getExternalServicePodName(adminServerPodName), "default");
1124-
String host = K8S_NODEPORT_HOST;
1125-
if (host.contains(":")) {
1126-
host = "[" + host + "]";
1127-
}
1128-
String hostAndPort = (OKD) ? adminSvcExtHost : host + ":" + adminServiceNodePort;
1129-
logger.info("hostAndPort = {0} ", hostAndPort);
1110+
} else {
1111+
String curlString = null;
1112+
if (OKE_CLUSTER_PRIVATEIP) {
1113+
String protocol = "http";
1114+
String port = "7001";
1115+
1116+
curlString = String.format(
1117+
KUBERNETES_CLI + " exec -n " + domainNamespace + " " + adminServerPodName + " -- curl -g -k %s://"
1118+
+ ADMIN_USERNAME_DEFAULT
1119+
+ ":"
1120+
+ ADMIN_PASSWORD_DEFAULT
1121+
+ "@" + adminServerPodName + ":%s/%s", protocol, port, resourcePath);
1122+
curlString = curlString + " --silent --show-error ";
1123+
} else {
1124+
int adminServiceNodePort
1125+
= getServiceNodePort(domainNamespace, getExternalServicePodName(adminServerPodName), "default");
1126+
String host = K8S_NODEPORT_HOST;
1127+
if (host.contains(":")) {
1128+
host = "[" + host + "]";
1129+
}
1130+
String hostAndPort = (OKD) ? adminSvcExtHost : host + ":" + adminServiceNodePort;
1131+
logger.info("hostAndPort = {0} ", hostAndPort);
11301132

1131-
curlString = String.format(
1132-
"curl -g --user "
1133-
+ ADMIN_USERNAME_DEFAULT
1134-
+ ":"
1135-
+ ADMIN_PASSWORD_DEFAULT
1136-
+ " http://%s%s/ --silent --show-error ", hostAndPort, resourcePath);
1133+
curlString = String.format("curl -g --user "
1134+
+ ADMIN_USERNAME_DEFAULT
1135+
+ ":"
1136+
+ ADMIN_PASSWORD_DEFAULT
1137+
+ " http://%s%s/ --silent --show-error ", hostAndPort, resourcePath);
1138+
}
1139+
logger.info(callerName + ": curl command {0}", curlString);
11371140

1138-
logger.info(callerName + ": curl command {0}", curlString);
1139-
try {
1140-
result = exec(curlString, true).stdout();
1141-
logger.info(callerName + ": exec curl command {0} got: {1}", curlString, result);
1142-
} catch (Exception ex) {
1143-
logger.info(callerName + ": caught unexpected exception {0}", ex);
1144-
return null;
1141+
try {
1142+
String result = exec(curlString, true).stdout();
1143+
logger.info(callerName + ": exec curl command {0} got: {1}", curlString, result);
1144+
returnString = result;
1145+
} catch (Exception ex) {
1146+
logger.info(callerName + ": caught unexpected exception {0}", ex);
1147+
}
11451148
}
1146-
return result;
1149+
1150+
return returnString;
11471151
}
11481152

11491153
/**

0 commit comments

Comments
 (0)