|
14 | 14 | import io.kubernetes.client.openapi.models.V1Pod;
|
15 | 15 | import oracle.weblogic.domain.DomainCondition;
|
16 | 16 | import oracle.weblogic.domain.DomainResource;
|
| 17 | +import oracle.weblogic.kubernetes.actions.impl.primitive.Command; |
| 18 | +import oracle.weblogic.kubernetes.actions.impl.primitive.CommandParams; |
17 | 19 | import oracle.weblogic.kubernetes.annotations.IntegrationTest;
|
18 | 20 | import oracle.weblogic.kubernetes.annotations.Namespaces;
|
19 | 21 | import oracle.weblogic.kubernetes.logging.LoggingFacade;
|
|
24 | 26 | import org.junit.jupiter.api.Tag;
|
25 | 27 | import org.junit.jupiter.api.Test;
|
26 | 28 |
|
| 29 | +import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT; |
| 30 | +import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT; |
27 | 31 | import static oracle.weblogic.kubernetes.TestConstants.MII_DYNAMIC_UPDATE_EXPECTED_ERROR_MSG;
|
| 32 | +import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER; |
28 | 33 | import static oracle.weblogic.kubernetes.TestConstants.OPERATOR_RELEASE_NAME;
|
| 34 | +import static oracle.weblogic.kubernetes.TestConstants.TRAEFIK_INGRESS_HTTP_HOSTPORT; |
29 | 35 | import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_SLIM;
|
30 | 36 | import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_VERSION;
|
31 | 37 | import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR;
|
|
45 | 51 | import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.verifyPodIntrospectVersionUpdated;
|
46 | 52 | import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.verifyPodsNotRolled;
|
47 | 53 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkSystemResourceConfig;
|
| 54 | +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkSystemResourceConfigViaAdminPod; |
| 55 | +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createIngressHostRouting; |
48 | 56 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.testUntil;
|
| 57 | +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.verifySystemResourceConfiguration; |
49 | 58 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.withStandardRetryPolicy;
|
50 | 59 | import static oracle.weblogic.kubernetes.utils.JobUtils.getIntrospectJobName;
|
51 | 60 | import static oracle.weblogic.kubernetes.utils.K8sEvents.DOMAIN_FAILED;
|
@@ -80,6 +89,7 @@ class ItMiiDynamicUpdatePart3 {
|
80 | 89 | public static Path pathToChangReadsYaml = null;
|
81 | 90 | static LoggingFacade logger = null;
|
82 | 91 | private static String operatorPodName = null;
|
| 92 | + private static String httpHostHeader = null; |
83 | 93 |
|
84 | 94 | /**
|
85 | 95 | * Install Operator.
|
@@ -318,15 +328,49 @@ void testMiiChangeDataSourceParameterWithCommitUpdateAndRoll() {
|
318 | 328 |
|
319 | 329 | verifyPodIntrospectVersionUpdated(pods.keySet(), introspectVersion, helper.domainNamespace);
|
320 | 330 |
|
| 331 | + |
321 | 332 | // check datasource configuration using REST api
|
322 |
| - int adminServiceNodePort |
323 |
| - = getServiceNodePort(helper.domainNamespace, getExternalServicePodName(helper.adminServerPodName), "default"); |
324 |
| - assertNotEquals(-1, adminServiceNodePort, "admin server default node port is not valid"); |
325 |
| - assertTrue(checkSystemResourceConfig(helper.adminSvcExtHost, adminServiceNodePort, |
326 |
| - "JDBCSystemResources/TestDataSource2/JDBCResource/JDBCDataSourceParams", |
327 |
| - "jdbc\\/TestDataSource2-2"), "JDBCSystemResource JNDIName not found"); |
| 333 | + if (OKE_CLUSTER) { |
| 334 | + assertTrue(checkSystemResourceConfigViaAdminPod(helper.adminServerPodName, helper.domainNamespace, |
| 335 | + "JDBCSystemResources/TestDataSource2/JDBCResource/JDBCDataSourceParams", |
| 336 | + "jdbc\\/TestDataSource2-2"), "JDBCSystemResource JNDIName not found"); |
| 337 | + } else { |
| 338 | + int adminServiceNodePort |
| 339 | + = getServiceNodePort(helper.domainNamespace, getExternalServicePodName(helper.adminServerPodName), "default"); |
| 340 | + assertNotEquals(-1, adminServiceNodePort, "admin server default node port is not valid"); |
| 341 | + |
| 342 | + // create ingress for admin service |
| 343 | + // use traefik LB for kind cluster with ingress host header in url |
| 344 | + if (TestConstants.KIND_CLUSTER |
| 345 | + && !TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) { |
| 346 | + httpHostHeader = createIngressHostRouting(helper.domainNamespace, domainUid, |
| 347 | + helper.adminServerName, 7001); |
| 348 | + StringBuffer curlString = new StringBuffer("curl -g --user "); |
| 349 | + curlString.append(ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT) |
| 350 | + .append(" --noproxy '*' " |
| 351 | + + " -H 'host: " + httpHostHeader + "' " + " http://" + "localhost:" |
| 352 | + + TRAEFIK_INGRESS_HTTP_HOSTPORT) |
| 353 | + .append("/management/weblogic/latest/domainConfig") |
| 354 | + .append("/") |
| 355 | + .append("JDBCSystemResources/TestDataSource2/JDBCResource/JDBCDataSourceParams") |
| 356 | + .append("/"); |
| 357 | + |
| 358 | + logger.info("curl command {0}", new String(curlString)); |
| 359 | + |
| 360 | + assertTrue(Command |
| 361 | + .withParams(new CommandParams() |
| 362 | + .command(curlString.toString())) |
| 363 | + .executeAndVerify("jdbc\\/TestDataSource2-2"), "JDBCSystemResource JNDIName not found"); |
| 364 | + } else { |
| 365 | + assertTrue(checkSystemResourceConfig(helper.adminSvcExtHost, adminServiceNodePort, |
| 366 | + "JDBCSystemResources/TestDataSource2/JDBCResource/JDBCDataSourceParams", |
| 367 | + "jdbc\\/TestDataSource2-2"), "JDBCSystemResource JNDIName not found"); |
| 368 | + |
| 369 | + } |
| 370 | + } |
328 | 371 | logger.info("JDBCSystemResource configuration found");
|
329 | 372 |
|
| 373 | + |
330 | 374 | // check that the domain status condition contains the correct type and expected reason
|
331 | 375 | logger.info("verifying the domain status condition contains the correct type and expected status");
|
332 | 376 | helper.verifyDomainStatusConditionNoErrorMsg("Completed", "True");
|
@@ -363,13 +407,27 @@ void testMiiChangeDataSourceParameterWithCommitUpdateAndRoll() {
|
363 | 407 | verifyPodIntrospectVersionUpdated(pods.keySet(), introspectVersion, helper.domainNamespace);
|
364 | 408 |
|
365 | 409 | // check datasource configuration is deleted using REST api
|
366 |
| - adminServiceNodePort |
367 |
| - = getServiceNodePort(helper.domainNamespace, getExternalServicePodName(helper.adminServerPodName), "default"); |
368 |
| - assertNotEquals(-1, adminServiceNodePort, "admin server default node port is not valid"); |
369 |
| - assertFalse(checkSystemResourceConfig(helper.adminSvcExtHost, adminServiceNodePort, "JDBCSystemResources", |
370 |
| - "TestDataSource2"), "Found JDBCSystemResource datasource, should be deleted"); |
| 410 | + if (OKE_CLUSTER) { |
| 411 | + assertFalse(checkSystemResourceConfigViaAdminPod(helper.adminServerPodName, helper.domainNamespace, |
| 412 | + "JDBCSystemResources", |
| 413 | + "TestDataSource2"), "Found JDBCSystemResource datasource, should be deleted"); |
| 414 | + } else { |
| 415 | + int adminServiceNodePort |
| 416 | + = getServiceNodePort(helper.domainNamespace, getExternalServicePodName(helper.adminServerPodName), "default"); |
| 417 | + assertNotEquals(-1, adminServiceNodePort, "admin server default node port is not valid"); |
| 418 | + if (TestConstants.KIND_CLUSTER |
| 419 | + && !TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) { |
| 420 | + assertFalse(checkSystemResourceConfig(helper.adminSvcExtHost, adminServiceNodePort, "JDBCSystemResources", |
| 421 | + "TestDataSource2"), "Found JDBCSystemResource datasource, should be deleted"); |
| 422 | + } else { |
| 423 | + verifySystemResourceConfiguration(null, adminServiceNodePort, |
| 424 | + "JDBCSystemResources", "TestDataSource2", "404", httpHostHeader); |
| 425 | + } |
| 426 | + } |
371 | 427 | logger.info("JDBCSystemResource Datasource is deleted");
|
372 | 428 |
|
| 429 | + |
| 430 | + |
373 | 431 | // check that the domain status condition contains the correct type and expected status
|
374 | 432 | logger.info("verifying the domain status condition contains the correct type and expected status");
|
375 | 433 | helper.verifyDomainStatusConditionNoErrorMsg("Completed", "True");
|
|
0 commit comments