Skip to content

Commit 5637577

Browse files
sankarpnrjeberhard
authored andcommitted
Fix for nightly failure in ItIstioMiiDomain
1 parent 2db0a37 commit 5637577

File tree

7 files changed

+69
-93
lines changed

7 files changed

+69
-93
lines changed

Jenkinsfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ EOF
470470
echo "-Dwko.it.grafana.chart.version=\"${GRAFANA_CHART_VERSION}\"" >> ${WORKSPACE}/.mvn/maven.config
471471
echo "-Dwko.it.collect.logs.on.success=\"${COLLECT_LOGS_ON_SUCCESS}\"" >> ${WORKSPACE}/.mvn/maven.config
472472
echo "-Dwko.it.remoteconsole.version=\"${REMOTECONSOLE_VERSION}\"" >> ${WORKSPACE}/.mvn/maven.config
473+
echo "-Djdk.httpclient.allowRestrictedHeaders=\"host\"" >> ${WORKSPACE}/.mvn/maven.config
473474
474475
475476
echo "${WORKSPACE}/.mvn/maven.config contents:"

Jenkinsfile.kindnightly

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ EOF
506506
echo "-Dwko.it.grafana.chart.version=\"${GRAFANA_CHART_VERSION}\"" >> ${WORKSPACE}/.mvn/maven.config
507507
echo "-Dwko.it.collect.logs.on.success=\"${COLLECT_LOGS_ON_SUCCESS}\"" >> ${WORKSPACE}/.mvn/maven.config
508508
echo "-Dwko.it.remoteconsole.version=\"${REMOTECONSOLE_VERSION}\"" >> ${WORKSPACE}/.mvn/maven.config
509+
echo "-Djdk.httpclient.allowRestrictedHeaders=\"host\"" >> ${WORKSPACE}/.mvn/maven.config
509510

510511

511512
echo "${WORKSPACE}/.mvn/maven.config contents:"

integration-tests/src/test/java/oracle/weblogic/domain/OnlineUpdate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
public class OnlineUpdate {
1212

1313
@ApiModelProperty("Enable online update.")
14-
private Boolean enabled = false;
14+
public Boolean enabled = false;
1515

1616
@ApiModelProperty("If set to true, it will rollback the changes if the update require domain restart. "
1717
+ "All changes are rolled back, the domain continues to run without interruption. "

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,12 +1396,12 @@ private static void verifyMemberHealth(String adminServerPodName, List<String> m
13961396
private void verifyConnectionBetweenClusterMembers(String serverName, List<String> managedServerNames) {
13971397
String podName = domainUid + "-" + serverName;
13981398
final String command = String.format(
1399-
KUBERNETES_CLI + " exec -n " + introDomainNamespace + " " + podName + " -- curl http://"
1399+
KUBERNETES_CLI + " exec -n " + introDomainNamespace + " " + podName + " -- curl \"http://"
14001400
+ wlsUserName
14011401
+ ":"
14021402
+ wlsPassword
14031403
+ "@" + podName + ":%s/clusterview/ClusterViewServlet"
1404-
+ "\"?user=" + wlsUserName
1404+
+ "?user=" + wlsUserName
14051405
+ "&password=" + wlsPassword + "\"",managedServerPort);
14061406
verifyServerCommunication(command, serverName, managedServerNames);
14071407
}

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

Lines changed: 60 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
package oracle.weblogic.kubernetes;
55

6+
import java.io.IOException;
67
import java.net.InetAddress;
8+
import java.net.UnknownHostException;
79
import java.net.http.HttpResponse;
810
import java.nio.file.Path;
911
import java.nio.file.Paths;
@@ -24,7 +26,6 @@
2426
import oracle.weblogic.domain.Model;
2527
import oracle.weblogic.domain.OnlineUpdate;
2628
import oracle.weblogic.domain.ServerPod;
27-
import oracle.weblogic.kubernetes.annotations.DisabledOn12213Image;
2829
import oracle.weblogic.kubernetes.annotations.IntegrationTest;
2930
import oracle.weblogic.kubernetes.annotations.Namespaces;
3031
import oracle.weblogic.kubernetes.logging.LoggingFacade;
@@ -43,6 +44,7 @@
4344
import static oracle.weblogic.kubernetes.TestConstants.ISTIO_HTTP_HOSTPORT;
4445
import static oracle.weblogic.kubernetes.TestConstants.K8S_NODEPORT_HOST;
4546
import static oracle.weblogic.kubernetes.TestConstants.KUBERNETES_CLI;
47+
import static oracle.weblogic.kubernetes.TestConstants.MII_BASIC_APP_DEPLOYMENT_NAME;
4648
import static oracle.weblogic.kubernetes.TestConstants.MII_BASIC_IMAGE_NAME;
4749
import static oracle.weblogic.kubernetes.TestConstants.MII_BASIC_IMAGE_TAG;
4850
import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER;
@@ -52,21 +54,17 @@
5254
import static oracle.weblogic.kubernetes.actions.ActionConstants.WORK_DIR;
5355
import static oracle.weblogic.kubernetes.actions.TestActions.addLabelsToNamespace;
5456
import static oracle.weblogic.kubernetes.actions.TestActions.patchDomainResourceWithNewIntrospectVersion;
55-
import static oracle.weblogic.kubernetes.utils.ApplicationUtils.checkAppUsingHostHeader;
5657
import static oracle.weblogic.kubernetes.utils.ClusterUtils.createClusterResourceAndAddReferenceToDomain;
5758
import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.replaceConfigMapWithModelFiles;
5859
import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.verifyIntrospectorRuns;
5960
import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.verifyPodIntrospectVersionUpdated;
6061
import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.verifyPodsNotRolled;
6162
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReadyAndServiceExists;
62-
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createTestWebAppWarFile;
6363
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.formatIPv6Host;
6464
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getServiceExtIPAddrtOke;
65-
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.isAppInServerPodReady;
6665
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.testUntil;
6766
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.withStandardRetryPolicy;
6867
import static oracle.weblogic.kubernetes.utils.ConfigMapUtils.createConfigMapAndVerify;
69-
import static oracle.weblogic.kubernetes.utils.DeployUtil.deployUsingRest;
7068
import static oracle.weblogic.kubernetes.utils.DomainUtils.createDomainAndVerify;
7169
import static oracle.weblogic.kubernetes.utils.FileUtils.generateFileFromTemplate;
7270
import static oracle.weblogic.kubernetes.utils.FileUtils.replaceStringInFile;
@@ -133,10 +131,7 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
133131
labelMap.put("istio-injection", "enabled");
134132
assertDoesNotThrow(() -> addLabelsToNamespace(domainNamespace,labelMap));
135133
assertDoesNotThrow(() -> addLabelsToNamespace(opNamespace,labelMap));
136-
137-
// create testwebapp.war
138-
testWebAppWarLoc = createTestWebAppWarFile(domainNamespace);
139-
134+
140135
// install and verify operator
141136
installAndVerifyOperator(opNamespace, domainNamespace);
142137

@@ -150,24 +145,20 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
150145
* Deploy istio gateways and virtual service.
151146
*
152147
* Verify server pods are in ready state and services are created.
153-
* Verify WebLogic console is accessible thru istio ingress port.
154-
* Deploy a web application thru istio http ingress port using REST api.
155-
* Access web application thru istio http ingress port using curl.
148+
* Verify WebLogic REST interface is accessible thru istio ingress port.
156149
*
157150
* Create a configmap with a sparse model file to add a new workmanager
158151
* with custom min threads constraint and a max threads constraint
159152
* Patch the domain resource with the configmap.
160153
* Update the introspect version of the domain resource.
161-
* Verify rolling restart of the domain by comparing PodCreationTimestamp
162-
* before and after rolling restart.
154+
* Verify the changes are applied without rolling restart of the domain by comparing PodCreationTimestamp
163155
* Verify new work manager is configured.
164156
*/
165157
@Test
166158
@DisplayName("Create WebLogic Domain with mii model with istio")
167159
@Tag("gate")
168160
@Tag("crio")
169-
@DisabledOn12213Image
170-
void testIstioModelInImageDomainModified() {
161+
void testIstioModelInImageDomain() throws UnknownHostException, IOException, InterruptedException {
171162

172163
// Create the repo secret to pull the image
173164
// this secret is used only for non-kind cluster
@@ -177,21 +168,21 @@ void testIstioModelInImageDomainModified() {
177168
logger.info("Create secret for admin credentials");
178169
String adminSecretName = "weblogic-credentials";
179170
assertDoesNotThrow(() -> createSecretWithUsernamePassword(
180-
adminSecretName,
181-
domainNamespace,
182-
ADMIN_USERNAME_DEFAULT,
183-
ADMIN_PASSWORD_DEFAULT),
171+
adminSecretName,
172+
domainNamespace,
173+
ADMIN_USERNAME_DEFAULT,
174+
ADMIN_PASSWORD_DEFAULT),
184175
String.format("createSecret failed for %s", adminSecretName));
185176

186177
// create encryption secret
187178
logger.info("Create encryption secret");
188179
String encryptionSecretName = "encryptionsecret";
189180
assertDoesNotThrow(() -> createSecretWithUsernamePassword(
190-
encryptionSecretName,
191-
domainNamespace,
192-
"weblogicenc",
193-
"weblogicenc"),
194-
String.format("createSecret failed for %s", encryptionSecretName));
181+
encryptionSecretName,
182+
domainNamespace,
183+
"weblogicenc",
184+
"weblogicenc"),
185+
String.format("createSecret failed for %s", encryptionSecretName));
195186

196187
// create WDT config map without any files
197188
createConfigMapAndVerify(configMapName, domainUid, domainNamespace, Collections.emptyList());
@@ -200,9 +191,7 @@ void testIstioModelInImageDomainModified() {
200191
DomainResource domain = createDomainResource(domainUid, domainNamespace, adminSecretName,
201192
TEST_IMAGES_REPO_SECRET_NAME, encryptionSecretName,
202193
MII_BASIC_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG, configMapName);
203-
domain = createClusterResourceAndAddReferenceToDomain(
204-
domainUid + "-" + clusterName, clusterName, domainNamespace, domain, replicaCount);
205-
194+
206195
// create model in image domain
207196
createDomainAndVerify(domain, domainNamespace);
208197

@@ -215,20 +204,20 @@ void testIstioModelInImageDomainModified() {
215204
managedServerPrefix + i, domainNamespace);
216205
checkPodReadyAndServiceExists(managedServerPrefix + i, domainUid, domainNamespace);
217206
}
218-
207+
219208
// delete the mTLS mode
220209
ExecResult result = assertDoesNotThrow(() -> ExecCommand.exec(KUBERNETES_CLI + " delete -f "
221210
+ Paths.get(WORK_DIR, "istio-tls-mode.yaml").toString(), true));
222211
assertEquals(0, result.exitValue(), "Got expected exit value");
223212
logger.info(result.stdout());
224-
logger.info(result.stderr());
213+
logger.info(result.stderr());
225214

226215
String clusterService = domainUid + "-cluster-" + clusterName + "." + domainNamespace + ".svc.cluster.local";
227216

228-
Map<String, String> templateMap = new HashMap<>();
217+
Map<String, String> templateMap = new HashMap<>();
229218
templateMap.put("NAMESPACE", domainNamespace);
230219
templateMap.put("DUID", domainUid);
231-
templateMap.put("ADMIN_SERVICE",adminServerPodName);
220+
templateMap.put("ADMIN_SERVICE", adminServerPodName);
232221
templateMap.put("CLUSTER_SERVICE", clusterService);
233222

234223
Path srcHttpFile = Paths.get(RESOURCE_DIR, "istio", "istio-http-template.yaml");
@@ -248,60 +237,34 @@ void testIstioModelInImageDomainModified() {
248237
deployRes = assertDoesNotThrow(() -> deployIstioDestinationRule(targetDrFile));
249238
assertTrue(deployRes, "Failed to deploy Istio DestinationRule");
250239

251-
int istioIngressPort = getIstioHttpIngressPort();
240+
int istioIngressPort = getIstioHttpIngressPort();
252241
String host = formatIPv6Host(K8S_NODEPORT_HOST);
253242
logger.info("Istio Ingress Port is {0}", istioIngressPort);
254-
logger.info("host {0}", host);
243+
logger.info("host {0}", host);
255244

256245
// In internal OKE env, use Istio EXTERNAL-IP; in non-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort
257246
String hostAndPort = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null
258247
? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) : host + ":" + istioIngressPort;
259-
260-
try {
261-
if (!TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
262-
istioIngressPort = ISTIO_HTTP_HOSTPORT;
263-
hostAndPort = InetAddress.getLocalHost().getHostAddress() + ":" + istioIngressPort;
264-
}
265-
Map<String, String> headers = new HashMap<>();
266-
headers.put("host", domainNamespace + ".org");
267-
headers.put("Authorization", ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT);
268-
String url = "http://" + hostAndPort + "/management/tenant-monitoring/servers/";
269-
HttpResponse<String> response;
270-
response = OracleHttpClient.get(url, headers, true);
271-
assertEquals(200, response.statusCode());
272-
assertTrue(response.body().contains("RUNNING"));
273-
} catch (Exception ex) {
274-
logger.severe(ex.getMessage());
275-
}
276248

277-
if (OKE_CLUSTER) {
278-
// create secret for internal OKE cluster
279-
createBaseRepoSecret(domainNamespace);
280-
}
249+
Map<String, String> headers = new HashMap<>();
250+
headers.put("host", domainNamespace + ".org");
251+
headers.put("Authorization", ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT);
281252

282-
Path archivePath = Paths.get(testWebAppWarLoc);
283-
String target = "{identity: [clusters,'" + clusterName + "']}";
284-
ExecResult deployUsingRest = deployUsingRest(hostAndPort, ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT,
285-
target, archivePath, domainNamespace + ".org", "testwebapp");
253+
if (!TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
254+
istioIngressPort = ISTIO_HTTP_HOSTPORT;
255+
hostAndPort = InetAddress.getLocalHost().getHostAddress() + ":" + istioIngressPort;
256+
}
286257

287-
assertNotNull(deployUsingRest, "Application deployment failed");
288-
logger.info("Application deployment returned {0}", deployUsingRest.toString());
289-
assertEquals("202", deployUsingRest.stdout(), "Deployment didn't return HTTP status code 202");
290-
logger.info("Application {0} deployed successfully at {1}", "testwebapp.war", domainUid + "-" + clusterName);
258+
String url = "http://" + hostAndPort + "/management/tenant-monitoring/servers/";
259+
HttpResponse<String> response;
260+
response = OracleHttpClient.get(url, headers, true);
261+
assertEquals(200, response.statusCode());
262+
assertTrue(response.body().contains("RUNNING"));
291263

292264
if (OKE_CLUSTER) {
293-
testUntil(isAppInServerPodReady(domainNamespace,
294-
managedServerPrefix + 1, 8001, "/testwebapp/index.jsp", "testwebapp"),
295-
logger, "Check Deployed App {0} in server {1}",
296-
archivePath,
297-
target);
298-
} else {
299-
String url = "http://" + hostAndPort + "/testwebapp/index.jsp";
300-
logger.info("Application Access URL {0}", url);
301-
boolean checkApp = checkAppUsingHostHeader(url, domainNamespace + ".org");
302-
assertTrue(checkApp, "Failed to access WebLogic application");
265+
// create secret for internal OKE cluster
266+
createBaseRepoSecret(domainNamespace);
303267
}
304-
logger.info("Application /testwebapp/index.jsp is accessble to {0}", domainUid);
305268

306269
//Verify the dynamic configuration update
307270
LinkedHashMap<String, OffsetDateTime> pods = new LinkedHashMap<>();
@@ -319,17 +282,13 @@ void testIstioModelInImageDomainModified() {
319282
Arrays.asList(MODEL_DIR + "/model.config.wm.yaml"), withStandardRetryPolicy);
320283

321284
String introspectVersion = patchDomainResourceWithNewIntrospectVersion(domainUid, domainNamespace);
322-
323285
verifyIntrospectorRuns(domainUid, domainNamespace);
324286

325287
String resourcePath = "/management/weblogic/latest/domainRuntime"
326-
+ "/serverRuntimes/managed-server1/applicationRuntimes"
327-
+ "/testwebapp/workManagerRuntimes/newWM/"
328-
+ "maxThreadsConstraintRuntime ";
329-
String wmRuntimeUrl = "http://" + hostAndPort + resourcePath;
330-
331-
boolean checkWm = checkAppUsingHostHeader(wmRuntimeUrl, domainNamespace + ".org");
332-
assertTrue(checkWm, "Failed to access WorkManagerRuntime");
288+
+ "/serverRuntimes/managed-server1/applicationRuntimes/"
289+
+ MII_BASIC_APP_DEPLOYMENT_NAME + "/workManagerRuntimes/newWM/";
290+
String wmRuntimeUrl = "http://" + hostAndPort + resourcePath;
291+
checkApp(wmRuntimeUrl, headers);
333292
logger.info("Found new work manager runtime");
334293

335294
verifyPodsNotRolled(domainNamespace, pods);
@@ -368,14 +327,16 @@ private DomainResource createDomainResource(String domainUid, String domNamespac
368327
.value("-Djava.security.egd=file:/dev/./urandom ")))
369328
.adminServer(createAdminServer())
370329
.configuration(new Configuration()
371-
.model(new Model()
372-
.domainType("WLS")
373-
.configMap(configmapName)
374-
.onlineUpdate(new OnlineUpdate().enabled(true))
375-
.runtimeEncryptionSecret(encryptionSecretName))
330+
.model(new Model()
331+
.domainType("WLS")
332+
.configMap(configmapName)
333+
.onlineUpdate(new OnlineUpdate()
334+
.enabled(true))
335+
.runtimeEncryptionSecret(encryptionSecretName))
376336
.introspectorJobActiveDeadlineSeconds(300L)));
377337
setPodAntiAffinity(domain);
378-
return domain;
338+
return createClusterResourceAndAddReferenceToDomain(
339+
domainUid + "-" + clusterName, clusterName, domainNamespace, domain, replicaCount);
379340
}
380341

381342
private static void enableStrictMode(String namespace) {
@@ -392,4 +353,15 @@ private static void enableStrictMode(String namespace) {
392353
logger.info(result.stderr());
393354
});
394355
}
356+
357+
private void checkApp(String url, Map<String, String> headers) {
358+
testUntil(
359+
() -> {
360+
HttpResponse<String> response = OracleHttpClient.get(url, headers, true);
361+
return response.statusCode() == 200;
362+
},
363+
logger,
364+
"application to be ready {0}",
365+
url);
366+
}
395367
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static boolean checkAppUsingHostHeader(String url, String hostHeader, Boo
4343
if (hostHeader != null) {
4444
headerString = new StringBuffer("-H 'host: ");
4545
headerString.append(hostHeader)
46-
.append(" ' ");
46+
.append("' ");
4747
} else {
4848
headerString = new StringBuffer("");
4949
}

integration-tests/src/test/resources/istio/istio-http-template.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ spec:
4242

4343
- match:
4444
- uri:
45-
prefix: /testwebapp
45+
prefix: /myear
46+
- uri:
47+
prefix: /testwebapp
4648
- port: 8001
4749
route:
4850
- destination:

0 commit comments

Comments
 (0)