|
57 | 57 | import static oracle.weblogic.kubernetes.utils.DomainUtils.createDomainAndVerify;
|
58 | 58 | import static oracle.weblogic.kubernetes.utils.DomainUtils.deleteDomainResource;
|
59 | 59 | import static oracle.weblogic.kubernetes.utils.FmwUtils.createDomainResourceSimplifyJrfPv;
|
| 60 | +import static oracle.weblogic.kubernetes.utils.FmwUtils.createSimplifyJrfPvDomainAndRCU; |
60 | 61 | import static oracle.weblogic.kubernetes.utils.FmwUtils.restoreOpssWalletfileSecret;
|
61 | 62 | import static oracle.weblogic.kubernetes.utils.FmwUtils.saveAndRestoreOpssWalletfileSecret;
|
62 | 63 | import static oracle.weblogic.kubernetes.utils.FmwUtils.verifyDomainReady;
|
@@ -99,21 +100,27 @@ public class ItFmwDomainInPvUserCreateRcu {
|
99 | 100 | private static LoggingFacade logger = null;
|
100 | 101 | private static String DOMAINHOMEPREFIX = null;
|
101 | 102 | private static final String domainUid1 = "jrfdomainonpv-userrcu1";
|
| 103 | + private static final String domainUid3 = "jrfdomainonpv-userrcu3"; |
102 | 104 | private static final String domainUid4 = "jrfdomainonpv-userrcu4";
|
103 | 105 | private static final String miiAuxiliaryImage1Tag = "jrf1" + MII_BASIC_IMAGE_TAG;
|
104 | 106 | private final String adminSecretName1 = domainUid1 + "-weblogic-credentials";
|
105 |
| - private final String rcuaccessSecretName1 = domainUid1 + "-rcu-credentials"; |
106 |
| - private final String opsswalletpassSecretName1 = domainUid1 + "-opss-wallet-password-secret"; |
107 |
| - private final String opsswalletfileSecretName1 = domainUid1 + "-opss-wallet-file-secret"; |
| 107 | + private final String adminSecretName3 = domainUid3 + "-weblogic-credentials"; |
108 | 108 | private final String adminSecretName4 = domainUid4 + "-weblogic-credentials";
|
| 109 | + private final String rcuaccessSecretName1 = domainUid1 + "-rcu-credentials"; |
| 110 | + private final String rcuaccessSecretName3 = domainUid3 + "-rcu-credentials"; |
109 | 111 | private final String rcuaccessSecretName4 = domainUid4 + "-rcu-credentials";
|
| 112 | + private final String opsswalletpassSecretName1 = domainUid1 + "-opss-wallet-password-secret"; |
| 113 | + private final String opsswalletpassSecretName3 = domainUid3 + "-opss-wallet-password-secret"; |
110 | 114 | private final String opsswalletpassSecretName4 = domainUid4 + "-opss-wallet-password-secret";
|
| 115 | + private final String opsswalletfileSecretName1 = domainUid1 + "-opss-wallet-file-secret"; |
| 116 | + private final String opsswalletfileSecretName3 = domainUid3 + "-opss-wallet-file-secret"; |
111 | 117 | private final String opsswalletfileSecretName4 = domainUid4 + "-opss-wallet-file-secret";
|
112 | 118 | private static final int replicaCount = 1;
|
113 | 119 |
|
114 | 120 | private final String fmwModelFilePrefix = "model-fmwdomainonpv-rcu-wdt";
|
115 | 121 | private final String fmwModelFile = fmwModelFilePrefix + ".yaml";
|
116 | 122 | private static DomainCreationImage domainCreationImage1 = null;
|
| 123 | + private static List<DomainCreationImage> domainCreationImages3 = new ArrayList<>(); |
117 | 124 | private static List<DomainCreationImage> domainCreationImages4 = new ArrayList<>();
|
118 | 125 | private static String configMapName = null;
|
119 | 126 |
|
@@ -390,117 +397,13 @@ void testFmwDomainOnPvUserProvideOpssNotexist() {
|
390 | 397 | checkPodDoesNotExist("rcu", null, dbNamespace);
|
391 | 398 |
|
392 | 399 | }
|
393 |
| - |
394 |
| - /** |
395 |
| - * User creates RCU, Operate creates PV/PVC and FMW domain with multiple images |
396 |
| - * Verify Pod is ready and service exists for both admin server and managed servers. |
397 |
| - */ |
398 |
| - @Test |
399 |
| - @Order(4) |
400 |
| - @DisplayName("Create a FMW domain on PV with multiple images when user per-creates RCU") |
401 |
| - void testFmwDomainOnPvUserCreatesRCUMultiImages() { |
402 |
| - String domainUid = "jrfdomainonpv-userrcu3"; |
403 |
| - String adminSecretName = domainUid + "-weblogic-credentials"; |
404 |
| - String rcuaccessSecretName = domainUid + "-rcu-credentials"; |
405 |
| - String opsswalletpassSecretName = domainUid + "-opss-wallet-password-secret"; |
406 |
| - final String pvName = getUniqueName(domainUid + "-pv-"); |
407 |
| - final String pvcName = getUniqueName(domainUid + "-pvc-"); |
408 |
| - |
409 |
| - //create RCU schema |
410 |
| - assertDoesNotThrow(() -> createRcuSchema(FMWINFRA_IMAGE_TO_USE_IN_SPEC, RCUSCHEMAPREFIX + "3", |
411 |
| - dbUrl, dbNamespace), "create RCU schema failed"); |
412 |
| - |
413 |
| - // create a model property file |
414 |
| - File fmwModelPropFile = createWdtPropertyFile(domainUid, RCUSCHEMAPREFIX + "3"); |
415 |
| - |
416 |
| - // Create the repo secret to pull the image |
417 |
| - // this secret is used only for non-kind cluster |
418 |
| - createTestRepoSecret(domainNamespace); |
419 |
| - |
420 |
| - // create secret for admin credentials |
421 |
| - logger.info("Create secret for admin credentials"); |
422 |
| - assertDoesNotThrow(() -> createSecretWithUsernamePassword( |
423 |
| - adminSecretName, |
424 |
| - domainNamespace, |
425 |
| - ADMIN_USERNAME_DEFAULT, |
426 |
| - ADMIN_PASSWORD_DEFAULT), |
427 |
| - String.format("createSecret failed for %s", adminSecretName)); |
428 |
| - |
429 |
| - // create RCU access secret |
430 |
| - logger.info("Creating RCU access secret: {0}, with prefix: {1}, dbUrl: {2}, schemapassword: {3})", |
431 |
| - rcuaccessSecretName, RCUSCHEMAPREFIX + "3", RCUSCHEMAPASSWORD, dbUrl); |
432 |
| - assertDoesNotThrow(() -> createRcuAccessSecret( |
433 |
| - rcuaccessSecretName, |
434 |
| - domainNamespace, |
435 |
| - RCUSCHEMAPREFIX + "3", |
436 |
| - RCUSCHEMAPASSWORD, |
437 |
| - dbUrl), |
438 |
| - String.format("createSecret failed for %s", rcuaccessSecretName)); |
439 |
| - |
440 |
| - logger.info("Create OPSS wallet password secret"); |
441 |
| - assertDoesNotThrow(() -> createOpsswalletpasswordSecret( |
442 |
| - opsswalletpassSecretName, |
443 |
| - domainNamespace, |
444 |
| - ADMIN_PASSWORD_DEFAULT), |
445 |
| - String.format("createSecret failed for %s", opsswalletpassSecretName)); |
446 |
| - |
447 |
| - DomainCreationImage domainCreationImage1 = createImage(fmwModelFile,fmwModelPropFile,"jrf3"); |
448 |
| - |
449 |
| - // image2 with model files for jms config |
450 |
| - List modelList = new ArrayList<>(); |
451 |
| - modelList.add(MODEL_DIR + "/model.jms2.yaml"); |
452 |
| - String miiAuxiliaryImageTag = "jrf3jms" + MII_BASIC_IMAGE_TAG; |
453 |
| - WitParams witParams = |
454 |
| - new WitParams() |
455 |
| - .modelImageName(MII_AUXILIARY_IMAGE_NAME) |
456 |
| - .modelImageTag(miiAuxiliaryImageTag) |
457 |
| - .wdtModelOnly(true) |
458 |
| - .modelFiles(modelList) |
459 |
| - .wdtVersion("NONE"); |
460 |
| - createAndPushAuxiliaryImage(MII_AUXILIARY_IMAGE_NAME, miiAuxiliaryImageTag, witParams); |
461 |
| - DomainCreationImage domainCreationImage2 = new DomainCreationImage().image(MII_AUXILIARY_IMAGE_NAME |
462 |
| - + ":" + miiAuxiliaryImageTag); |
463 |
| - List<DomainCreationImage> domainCreationImages = new ArrayList<>(); |
464 |
| - domainCreationImages.add(domainCreationImage1); |
465 |
| - domainCreationImages.add(domainCreationImage2); |
466 |
| - |
467 |
| - // create a domain custom resource configuration object |
468 |
| - logger.info("Creating domain custom resource with pvName: {0}", pvName); |
469 |
| - DomainResource domain = createDomainResourceSimplifyJrfPv( |
470 |
| - domainUid, domainNamespace, adminSecretName, |
471 |
| - TEST_IMAGES_REPO_SECRET_NAME, |
472 |
| - rcuaccessSecretName, |
473 |
| - opsswalletpassSecretName, null, |
474 |
| - pvName, pvcName, domainCreationImages, null); |
475 |
| - |
476 |
| - createDomainAndVerify(domain, domainNamespace); |
477 |
| - |
478 |
| - // verify that all servers are ready |
479 |
| - verifyDomainReady(domainNamespace, domainUid, replicaCount, "nosuffix"); |
480 |
| - |
481 |
| - //create router for admin service on OKD |
482 |
| - String adminServerPodName = domainUid + "-admin-server"; |
483 |
| - String adminSvcExtHost = createRouteForOKD(getExternalServicePodName(adminServerPodName), domainNamespace); |
484 |
| - logger.info("admin svc host = {0}", adminSvcExtHost); |
485 |
| - |
486 |
| - // check configuration for JMS |
487 |
| - checkConfiguredJMSresouce(domainNamespace, adminServerPodName, adminSvcExtHost); |
488 |
| - |
489 |
| - // delete the domain |
490 |
| - deleteDomainResource(domainNamespace, domainUid); |
491 |
| - //delete the rcu pod |
492 |
| - assertDoesNotThrow(() -> deletePod("rcu", dbNamespace), |
493 |
| - "Got exception while deleting server " + "rcu"); |
494 |
| - checkPodDoesNotExist("rcu", null, dbNamespace); |
495 |
| - |
496 |
| - } |
497 |
| - |
| 400 | + |
498 | 401 | /**
|
499 | 402 | * User creates RCU, Operate creates PV/PVC and FMW domain with additional WDT config map.
|
500 | 403 | * Verify Pod is ready and service exists for both admin server and managed servers.
|
501 | 404 | */
|
502 | 405 | @Test
|
503 |
| - @Order(5) |
| 406 | + @Order(4) |
504 | 407 | @DisplayName("Create a FMW domain on PV with additional WDT config map when user per-creates RCU")
|
505 | 408 | void testFmwDomainOnPvUserCreatesRCUwdtConfigMap() {
|
506 | 409 |
|
@@ -586,7 +489,7 @@ void testFmwDomainOnPvUserCreatesRCUwdtConfigMap() {
|
586 | 489 | * The operator will not mount the secret but proceed with normal domain creation without error
|
587 | 490 | */
|
588 | 491 | @Test
|
589 |
| - @Order(6) |
| 492 | + @Order(5) |
590 | 493 | @DisplayName("Create a FMW domain on PV when user provide OPSS wallet file is empty")
|
591 | 494 | void testFmwDomainOnPvUserProvideEmptyOpss() {
|
592 | 495 |
|
@@ -651,6 +554,150 @@ void testFmwDomainOnPvUserProvideEmptyOpss() {
|
651 | 554 |
|
652 | 555 | }
|
653 | 556 |
|
| 557 | + /** |
| 558 | + * User creates RCU, Operate creates PV/PVC and FMW domain with multiple images |
| 559 | + * Verify Pod is ready and service exists for both admin server and managed servers. |
| 560 | + */ |
| 561 | + @Test |
| 562 | + @Order(6) |
| 563 | + @DisplayName("Create a FMW domain on PV with multiple images when user per-creates RCU") |
| 564 | + void testFmwDomainOnPvUserCreatesRCUMultiImages() { |
| 565 | + |
| 566 | + final String pvName = getUniqueName(domainUid3 + "-pv-"); |
| 567 | + final String pvcName = getUniqueName(domainUid3 + "-pvc-"); |
| 568 | + |
| 569 | + //create RCU schema |
| 570 | + assertDoesNotThrow(() -> createRcuSchema(FMWINFRA_IMAGE_TO_USE_IN_SPEC, RCUSCHEMAPREFIX + "3", |
| 571 | + dbUrl, dbNamespace), "create RCU schema failed"); |
| 572 | + |
| 573 | + // create a model property file |
| 574 | + File fmwModelPropFile = createWdtPropertyFile(domainUid3, RCUSCHEMAPREFIX + "3"); |
| 575 | + |
| 576 | + // Create the repo secret to pull the image |
| 577 | + // this secret is used only for non-kind cluster |
| 578 | + createTestRepoSecret(domainNamespace); |
| 579 | + |
| 580 | + // create secret for admin credentials |
| 581 | + logger.info("Create secret for admin credentials"); |
| 582 | + assertDoesNotThrow(() -> createSecretWithUsernamePassword( |
| 583 | + adminSecretName3, |
| 584 | + domainNamespace, |
| 585 | + ADMIN_USERNAME_DEFAULT, |
| 586 | + ADMIN_PASSWORD_DEFAULT), |
| 587 | + String.format("createSecret failed for %s", adminSecretName3)); |
| 588 | + |
| 589 | + // create RCU access secret |
| 590 | + logger.info("Creating RCU access secret: {0}, with prefix: {1}, dbUrl: {2}, schemapassword: {3})", |
| 591 | + rcuaccessSecretName3, RCUSCHEMAPREFIX + "3", RCUSCHEMAPASSWORD, dbUrl); |
| 592 | + assertDoesNotThrow(() -> createRcuAccessSecret( |
| 593 | + rcuaccessSecretName3, |
| 594 | + domainNamespace, |
| 595 | + RCUSCHEMAPREFIX + "3", |
| 596 | + RCUSCHEMAPASSWORD, |
| 597 | + dbUrl), |
| 598 | + String.format("createSecret failed for %s", rcuaccessSecretName3)); |
| 599 | + |
| 600 | + logger.info("Create OPSS wallet password secret"); |
| 601 | + assertDoesNotThrow(() -> createOpsswalletpasswordSecret( |
| 602 | + opsswalletpassSecretName3, |
| 603 | + domainNamespace, |
| 604 | + ADMIN_PASSWORD_DEFAULT), |
| 605 | + String.format("createSecret failed for %s", opsswalletpassSecretName3)); |
| 606 | + |
| 607 | + DomainCreationImage domainCreationImage1 = createImage(fmwModelFile,fmwModelPropFile,"jrf3"); |
| 608 | + |
| 609 | + // image2 with model files for jms config |
| 610 | + List modelList = new ArrayList<>(); |
| 611 | + modelList.add(MODEL_DIR + "/model.jms2.yaml"); |
| 612 | + String miiAuxiliaryImageTag = "jrf3jms" + MII_BASIC_IMAGE_TAG; |
| 613 | + WitParams witParams = |
| 614 | + new WitParams() |
| 615 | + .modelImageName(MII_AUXILIARY_IMAGE_NAME) |
| 616 | + .modelImageTag(miiAuxiliaryImageTag) |
| 617 | + .wdtModelOnly(true) |
| 618 | + .modelFiles(modelList) |
| 619 | + .wdtVersion("NONE"); |
| 620 | + createAndPushAuxiliaryImage(MII_AUXILIARY_IMAGE_NAME, miiAuxiliaryImageTag, witParams); |
| 621 | + DomainCreationImage domainCreationImage2 = new DomainCreationImage().image(MII_AUXILIARY_IMAGE_NAME |
| 622 | + + ":" + miiAuxiliaryImageTag); |
| 623 | + domainCreationImages3.add(domainCreationImage1); |
| 624 | + domainCreationImages3.add(domainCreationImage2); |
| 625 | + |
| 626 | + // create a domain custom resource configuration object |
| 627 | + logger.info("Creating domain custom resource with pvName: {0}", pvName); |
| 628 | + DomainResource domain = createDomainResourceSimplifyJrfPv( |
| 629 | + domainUid3, domainNamespace, adminSecretName3, |
| 630 | + TEST_IMAGES_REPO_SECRET_NAME, |
| 631 | + rcuaccessSecretName3, |
| 632 | + opsswalletpassSecretName3, null, |
| 633 | + pvName, pvcName, domainCreationImages3, null); |
| 634 | + |
| 635 | + createDomainAndVerify(domain, domainNamespace); |
| 636 | + |
| 637 | + // verify that all servers are ready |
| 638 | + verifyDomainReady(domainNamespace, domainUid3, replicaCount, "nosuffix"); |
| 639 | + |
| 640 | + //create router for admin service on OKD |
| 641 | + String adminServerPodName = domainUid3 + "-admin-server"; |
| 642 | + String adminSvcExtHost = createRouteForOKD(getExternalServicePodName(adminServerPodName), domainNamespace); |
| 643 | + logger.info("admin svc host = {0}", adminSvcExtHost); |
| 644 | + |
| 645 | + // check configuration for JMS |
| 646 | + checkConfiguredJMSresouce(domainNamespace, adminServerPodName, adminSvcExtHost); |
| 647 | + |
| 648 | + } |
| 649 | + |
| 650 | + /** |
| 651 | + * Export the OPSS wallet file secret of Fmw domain from the previous run |
| 652 | + * CrateIfNotExists set to domainAndRCU |
| 653 | + * Use this OPSS wallet file secret to create Fmw domain on PV to connect to the same database |
| 654 | + * Verify Pod is ready and service exists for both admin server and managed servers. |
| 655 | + */ |
| 656 | + @Test |
| 657 | + @Order(7) |
| 658 | + @DisplayName("Create a FMW domain on PV with provided OPSS wallet file secret") |
| 659 | + void testFmwDomainOnPVwithProvidedOpss() { |
| 660 | + |
| 661 | + final String pvName = getUniqueName(domainUid3 + "-pv-"); |
| 662 | + final String pvcName = getUniqueName(domainUid3 + "-pvc-"); |
| 663 | + |
| 664 | + saveAndRestoreOpssWalletfileSecret(domainNamespace, domainUid3, opsswalletfileSecretName3); |
| 665 | + logger.info("Deleting domain custom resource with namespace: {0}, domainUid {1}", domainNamespace, domainUid3); |
| 666 | + deleteDomainResource(domainNamespace, domainUid3); |
| 667 | + try { |
| 668 | + deleteDirectory(Paths.get("/share").toFile()); |
| 669 | + } catch (IOException ioe) { |
| 670 | + logger.severe("Failed to cleanup directory /share", ioe); |
| 671 | + } |
| 672 | + logger.info("Creating domain custom resource with pvName: {0}", pvName); |
| 673 | + DomainResource domain = createSimplifyJrfPvDomainAndRCU( |
| 674 | + domainUid3, domainNamespace, adminSecretName3, |
| 675 | + TEST_IMAGES_REPO_SECRET_NAME, |
| 676 | + rcuaccessSecretName3, |
| 677 | + opsswalletpassSecretName3, opsswalletfileSecretName3, |
| 678 | + pvName, pvcName, domainCreationImages3, null); |
| 679 | + |
| 680 | + createDomainAndVerify(domain, domainNamespace); |
| 681 | + |
| 682 | + // verify that all servers are ready |
| 683 | + verifyDomainReady(domainNamespace, domainUid3, replicaCount, "nosuffix"); |
| 684 | + |
| 685 | + // delete the domain |
| 686 | + deleteDomainResource(domainNamespace, domainUid3); |
| 687 | + //delete the rcu pod |
| 688 | + assertDoesNotThrow(() -> deletePod("rcu", dbNamespace), |
| 689 | + "Got exception while deleting server " + "rcu"); |
| 690 | + checkPodDoesNotExist("rcu", null, dbNamespace); |
| 691 | + //delete the wallet file ewallet.p12 |
| 692 | + try { |
| 693 | + delete(new File("./ewallet.p12")); |
| 694 | + logger.info("Wallet file ewallet.p12 is deleted"); |
| 695 | + } catch (IOException ioe) { |
| 696 | + logger.severe("Failed to delete file ewallet.p12", ioe); |
| 697 | + } |
| 698 | + } |
| 699 | + |
| 700 | + |
654 | 701 | private DomainCreationImage createImage(String fmwModelFile, File fmwModelPropFile, String imageTagPrefix) {
|
655 | 702 |
|
656 | 703 | List<String> modelList = new ArrayList<>();
|
|
0 commit comments