Skip to content

Commit 1413318

Browse files
committed
Merge branch 'xc-115853' into 'main'
Fix OCNE ItIstioMiiDomain test failure with restricted header host See merge request weblogic-cloud/weblogic-kubernetes-operator!4574
2 parents 655cbc5 + 0040b2b commit 1413318

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioMiiDomain.java

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import java.io.IOException;
77
import java.net.InetAddress;
88
import java.net.UnknownHostException;
9-
import java.net.http.HttpResponse;
109
import java.nio.file.Path;
1110
import java.nio.file.Paths;
1211
import java.time.OffsetDateTime;
@@ -31,7 +30,6 @@
3130
import oracle.weblogic.kubernetes.logging.LoggingFacade;
3231
import oracle.weblogic.kubernetes.utils.ExecCommand;
3332
import oracle.weblogic.kubernetes.utils.ExecResult;
34-
import oracle.weblogic.kubernetes.utils.OracleHttpClient;
3533
import org.junit.jupiter.api.BeforeAll;
3634
import org.junit.jupiter.api.DisplayName;
3735
import org.junit.jupiter.api.Tag;
@@ -46,13 +44,15 @@
4644
import static oracle.weblogic.kubernetes.TestConstants.KUBERNETES_CLI;
4745
import static oracle.weblogic.kubernetes.TestConstants.MII_BASIC_IMAGE_NAME;
4846
import static oracle.weblogic.kubernetes.TestConstants.MII_BASIC_IMAGE_TAG;
47+
import static oracle.weblogic.kubernetes.TestConstants.OCNE;
4948
import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER;
5049
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_REPO_SECRET_NAME;
5150
import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR;
5251
import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR;
5352
import static oracle.weblogic.kubernetes.actions.ActionConstants.WORK_DIR;
5453
import static oracle.weblogic.kubernetes.actions.TestActions.addLabelsToNamespace;
5554
import static oracle.weblogic.kubernetes.actions.TestActions.patchDomainResourceWithNewIntrospectVersion;
55+
import static oracle.weblogic.kubernetes.utils.ApplicationUtils.checkAppUsingHostHeader;
5656
import static oracle.weblogic.kubernetes.utils.ClusterUtils.createClusterResourceAndAddReferenceToDomain;
5757
import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.replaceConfigMapWithModelFiles;
5858
import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.verifyIntrospectorRuns;
@@ -243,25 +243,18 @@ void testIstioModelInImageDomain() throws UnknownHostException, IOException, Int
243243
String hostAndPort = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null
244244
? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) : host + ":" + istioIngressPort;
245245

246-
Map<String, String> headers = new HashMap<>();
247-
headers.put("host", domainNamespace + ".org");
248-
headers.put("Authorization", ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT);
249-
250246
String workManagers = "/management/weblogic/latest/domainConfig/selfTuning/workManagers/";
251247
String newWM = workManagers + "newWM/";
252-
if (!TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
248+
if (!TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT) && !OCNE) {
253249
istioIngressPort = ISTIO_HTTP_HOSTPORT;
254250
hostAndPort = InetAddress.getLocalHost().getHostAddress() + ":" + istioIngressPort;
255251
}
256252

257253
String url = "http://" + hostAndPort + "/management/tenant-monitoring/servers/";
258-
HttpResponse<String> response;
259-
response = OracleHttpClient.get(url, headers, true);
260-
assertEquals(200, response.statusCode());
261-
assertTrue(response.body().contains("RUNNING"));
262-
254+
checkApp(url);
255+
263256
String wmUrl = "http://" + hostAndPort + workManagers;
264-
checkApp(wmUrl, headers);
257+
checkApp(wmUrl);
265258

266259
if (OKE_CLUSTER) {
267260
// create secret for internal OKE cluster
@@ -287,9 +280,10 @@ void testIstioModelInImageDomain() throws UnknownHostException, IOException, Int
287280
verifyIntrospectorRuns(domainUid, domainNamespace);
288281

289282
wmUrl = "http://" + hostAndPort + workManagers;
290-
checkApp(wmUrl, headers);
283+
checkApp(wmUrl);
284+
291285
wmUrl = "http://" + hostAndPort + newWM;
292-
checkApp(wmUrl, headers);
286+
checkApp(wmUrl);
293287
logger.info("Found new work manager runtime");
294288

295289
verifyPodsNotRolled(domainNamespace, pods);
@@ -355,12 +349,9 @@ private static void enableStrictMode(String namespace) {
355349
});
356350
}
357351

358-
private void checkApp(String url, Map<String, String> headers) {
352+
private void checkApp(String url) {
359353
testUntil(
360-
() -> {
361-
HttpResponse<String> response = OracleHttpClient.get(url, headers, true);
362-
return response.statusCode() == 200;
363-
},
354+
() -> checkAppUsingHostHeader(url, domainNamespace + ".org"),
364355
logger,
365356
"application to be ready {0}",
366357
url);

0 commit comments

Comments
 (0)