|
70 | 70 | import static oracle.weblogic.kubernetes.TestConstants.OPERATOR_RELEASE_NAME;
|
71 | 71 | import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR;
|
72 | 72 | import static oracle.weblogic.kubernetes.actions.TestActions.deletePod;
|
| 73 | +import static oracle.weblogic.kubernetes.assertions.TestAssertions.pvcExists; |
73 | 74 | import static oracle.weblogic.kubernetes.utils.AuxiliaryImageUtils.createAndPushAuxiliaryImage;
|
74 | 75 | import static oracle.weblogic.kubernetes.utils.ClusterUtils.createClusterAndVerify;
|
75 | 76 | import static oracle.weblogic.kubernetes.utils.ClusterUtils.createClusterResource;
|
76 | 77 | import static oracle.weblogic.kubernetes.utils.ClusterUtils.deleteClusterCustomResourceAndVerify;
|
77 | 78 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.addSccToDBSvcAccount;
|
78 | 79 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getNextFreePort;
|
79 | 80 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getUniqueName;
|
| 81 | +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.testUntil; |
80 | 82 | import static oracle.weblogic.kubernetes.utils.DbUtils.createRcuAccessSecret;
|
81 | 83 | import static oracle.weblogic.kubernetes.utils.DbUtils.createRcuSchema;
|
82 | 84 | import static oracle.weblogic.kubernetes.utils.DbUtils.startOracleDB;
|
@@ -172,7 +174,7 @@ public static void initAll(@Namespaces(3) List<String> namespaces) {
|
172 | 174 | }
|
173 | 175 |
|
174 | 176 | /**
|
175 |
| - * Create a basic FMW domain on PV using simplified feature. |
| 177 | + * Create a basic FMW domain on PV. |
176 | 178 | * Operator will create PV/PVC/RCU/Domain.
|
177 | 179 | * Verify Pod is ready and service exists for both admin server and managed servers.
|
178 | 180 | */
|
@@ -277,12 +279,12 @@ void testOperatorCreatesPvPvcRcuDomain() {
|
277 | 279 | }
|
278 | 280 |
|
279 | 281 | /**
|
280 |
| - * Create a basic FMW domain on PV using simplified feature. |
281 |
| - * User creates PV/PVC, operator creates RCU and domain |
| 282 | + * Create a basic FMW domain on PV. |
| 283 | + * User creates PV/PVC, operator creates RCU and domain. |
282 | 284 | * Verify Pod is ready and service exists for both admin server and managed servers.
|
283 | 285 | */
|
284 | 286 | @Test
|
285 |
| - @DisplayName("Create a FMW domainon on PV. User creates PV/PVC and operator creates RCU and domain") |
| 287 | + @DisplayName("Create a FMW domain on PV. User creates PV/PVC and operator creates RCU and domain") |
286 | 288 | void testUserCreatesPvPvcOperatorCreatesRcuDomain() {
|
287 | 289 | String domainUid = "jrfonpv-simplified2";
|
288 | 290 | final String pvName = getUniqueName(domainUid + "-pv-");
|
@@ -365,12 +367,12 @@ void testUserCreatesPvPvcOperatorCreatesRcuDomain() {
|
365 | 367 | }
|
366 | 368 |
|
367 | 369 | /**
|
368 |
| - * Create a basic FMW domain on PV using simplified feature. |
| 370 | + * Create a basic FMW domain on PV. |
369 | 371 | * User creates PV/PVC and RCU schema, Operator creates domain
|
370 | 372 | * Verify Pod is ready and service exists for both admin server and managed servers.
|
371 | 373 | */
|
372 | 374 | @Test
|
373 |
| - @DisplayName("Create a FMW domainon on PV. User creates PV/PVC/RCU and operator creates domain") |
| 375 | + @DisplayName("Create a FMW domain on PV. User creates PV/PVC/RCU and operator creates domain") |
374 | 376 | void testUserCreatesPvPvcRcuOperatorCreatesDomain() {
|
375 | 377 | String domainUid = "jrfonpv-simplified3";
|
376 | 378 | final String pvName = getUniqueName(domainUid + "-pv-");
|
@@ -474,7 +476,7 @@ void testUserCreatesPvPvcRcuOperatorCreatesDomain() {
|
474 | 476 | }
|
475 | 477 |
|
476 | 478 | /**
|
477 |
| - * Create a basic WLS domain on PV using simplified feature. |
| 479 | + * Create a basic WLS domain on PV. |
478 | 480 | * Operator will create PV/PVC and WLS Domain.
|
479 | 481 | * Verify Pod is ready and service exists for both admin server and managed servers.
|
480 | 482 | */
|
@@ -577,7 +579,7 @@ void testOperatorCreatesPvPvcWlsDomain() {
|
577 | 579 | }
|
578 | 580 |
|
579 | 581 | /**
|
580 |
| - * Create a basic FMW domain on PV using simplified feature. |
| 582 | + * Create a basic FMW domain on PV. |
581 | 583 | * User creates RCU schema, Operator creates PV/PVC and JRF domain
|
582 | 584 | * The user creates multiple domain initialization images
|
583 | 585 | * Verify Pod is ready and service exists for both admin server and managed servers.
|
@@ -724,6 +726,137 @@ void testUserCreatesRcuOperatorCreatesPvPvcDomainMultipleImages() {
|
724 | 726 | checkPodDoesNotExist("rcu", null, dbNamespace);
|
725 | 727 | }
|
726 | 728 |
|
| 729 | + /** |
| 730 | + * Create a basic FMW domain on PV. |
| 731 | + * User creates PV and RCU schema, Operator creates PVC and JRF domain |
| 732 | + * Verfiy PVC is created. |
| 733 | + * Verify Pod is ready and service exists for both admin server and managed servers. |
| 734 | + */ |
| 735 | + @Test |
| 736 | + @DisplayName("Create a FMW domain on PV. User creates PV and RCU and operator creates PVC and domain") |
| 737 | + void testUserCreatesPvRcuOperatorCreatesPvcDomain() { |
| 738 | + String domainUid = "jrfonpv-simplified5"; |
| 739 | + final String pvName = getUniqueName(domainUid + "-pv-"); |
| 740 | + final String pvcName = getUniqueName(domainUid + "-pvc-"); |
| 741 | + final int t3ChannelPort = getNextFreePort(); |
| 742 | + final String wlSecretName = domainUid + "-weblogic-credentials"; |
| 743 | + final String fmwModelFile = fmwModelFilePrefix + ".yaml"; |
| 744 | + |
| 745 | + // create FMW domain credential secret |
| 746 | + createSecretWithUsernamePassword(wlSecretName, domainNamespace, |
| 747 | + ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT); |
| 748 | + |
| 749 | + // create persistent volume for domain |
| 750 | + createPV(pvName, domainUid, this.getClass().getSimpleName()); |
| 751 | + |
| 752 | + // create RCU schema |
| 753 | + assertDoesNotThrow(() -> createRcuSchema(FMWINFRA_IMAGE_TO_USE_IN_SPEC, RCUSCHEMAPREFIX + "5", dbUrl, |
| 754 | + dbNamespace), "create rcu schema failed"); |
| 755 | + |
| 756 | + // create RCU access secret |
| 757 | + String rcuAccessSecretName = domainUid + "-rcu-credentials"; |
| 758 | + logger.info("Creating RCU access secret: {0}, with prefix: {1}, dbUrl: {2}, schemapassword: {3})", |
| 759 | + rcuAccessSecretName, RCUSCHEMAPREFIX + "5", RCUSCHEMAPASSWORD, dbUrl); |
| 760 | + assertDoesNotThrow(() -> createRcuAccessSecret( |
| 761 | + rcuAccessSecretName, |
| 762 | + domainNamespace, |
| 763 | + RCUSCHEMAPREFIX + "5", |
| 764 | + RCUSCHEMAPASSWORD, |
| 765 | + dbUrl), |
| 766 | + String.format("createSecret failed for %s", rcuAccessSecretName)); |
| 767 | + |
| 768 | + // create a model property file |
| 769 | + File fmwModelPropFile = createWdtPropertyFile(domainUid, RCUSCHEMAPREFIX + "5"); |
| 770 | + |
| 771 | + // create domainCreationImage |
| 772 | + String domainCreationImageName1 = DOMAIN_IMAGES_REPO + "jrf-domain-on-pv-image5"; |
| 773 | + // create image with model and wdt installation files |
| 774 | + WitParams witParams = |
| 775 | + new WitParams() |
| 776 | + .modelImageName(domainCreationImageName1) |
| 777 | + .modelImageTag(MII_BASIC_IMAGE_TAG) |
| 778 | + .modelFiles(Collections.singletonList(MODEL_DIR + "/" + fmwModelFile)) |
| 779 | + .modelVariableFiles(Collections.singletonList(fmwModelPropFile.getAbsolutePath())); |
| 780 | + createAndPushAuxiliaryImage(domainCreationImageName1, MII_BASIC_IMAGE_TAG, witParams); |
| 781 | + |
| 782 | + DomainCreationImage domainCreationImage1 = |
| 783 | + new DomainCreationImage().image(domainCreationImageName1 + ":" + MII_BASIC_IMAGE_TAG); |
| 784 | + |
| 785 | + List<DomainCreationImage> domainCreationImages = new ArrayList<>(); |
| 786 | + domainCreationImages.add(domainCreationImage1); |
| 787 | + |
| 788 | + // create opss wallet password secret |
| 789 | + String opsswalletpassSecretName = domainUid + "-opss-wallet-password-secret"; |
| 790 | + logger.info("Create OPSS wallet password secret"); |
| 791 | + assertDoesNotThrow(() -> createOpsswalletpasswordSecret( |
| 792 | + opsswalletpassSecretName, |
| 793 | + domainNamespace, |
| 794 | + ADMIN_PASSWORD_DEFAULT), |
| 795 | + String.format("createSecret failed for %s", opsswalletpassSecretName)); |
| 796 | + |
| 797 | + // create a domain resource |
| 798 | + logger.info("Creating domain custom resource"); |
| 799 | + Map<String, Quantity> pvcRequest = new HashMap<>(); |
| 800 | + pvcRequest.put("storage", new Quantity("2Gi")); |
| 801 | + |
| 802 | + Configuration configuration = new Configuration() |
| 803 | + .addSecretsItem(rcuAccessSecretName) |
| 804 | + .initializeDomainOnPV(new InitializeDomainOnPV() |
| 805 | + .persistentVolumeClaim(new PersistentVolumeClaim() |
| 806 | + .metadata(new V1ObjectMeta() |
| 807 | + .name(pvcName)) |
| 808 | + .spec(new PersistentVolumeClaimSpec() |
| 809 | + .storageClassName("weblogic-domain-storage-class") |
| 810 | + .resources(new V1ResourceRequirements() |
| 811 | + .requests(pvcRequest)))) |
| 812 | + .domain(new DomainOnPV() |
| 813 | + .createMode(CreateIfNotExists.DOMAIN) |
| 814 | + .domainCreationImages(domainCreationImages) |
| 815 | + .domainType(DomainOnPVType.JRF) |
| 816 | + .opss(new Opss() |
| 817 | + .walletPasswordSecret(opsswalletpassSecretName)))); |
| 818 | + |
| 819 | + DomainResource domain = createDomainResourceOnPv( |
| 820 | + domainUid, |
| 821 | + domainNamespace, |
| 822 | + wlSecretName, |
| 823 | + clusterName, |
| 824 | + pvName, |
| 825 | + pvcName, |
| 826 | + DOMAINHOMEPREFIX, |
| 827 | + replicaCount, |
| 828 | + t3ChannelPort, |
| 829 | + configuration); |
| 830 | + |
| 831 | + // Set the inter-pod anti-affinity for the domain custom resource |
| 832 | + setPodAntiAffinity(domain); |
| 833 | + |
| 834 | + // create a domain custom resource and verify domain is created |
| 835 | + createDomainAndVerify(domain, domainNamespace); |
| 836 | + |
| 837 | + // verify PVC is created |
| 838 | + testUntil( |
| 839 | + assertDoesNotThrow(() -> pvcExists(pvcName, domainNamespace), |
| 840 | + String.format("pvcExists failed with ApiException when checking pvc %s in namespace %s", |
| 841 | + pvcName, domainNamespace)), |
| 842 | + logger, |
| 843 | + "persistent volume claim {0} exists in namespace {1}", |
| 844 | + pvcName, |
| 845 | + domainNamespace); |
| 846 | + |
| 847 | + // verify that all servers are ready |
| 848 | + verifyDomainReady(domainNamespace, domainUid, replicaCount, "nosuffix"); |
| 849 | + |
| 850 | + // delete the domain |
| 851 | + deleteDomainResource(domainNamespace, domainUid); |
| 852 | + // delete the cluster |
| 853 | + deleteClusterCustomResourceAndVerify(domainUid + "-" + clusterName, domainNamespace); |
| 854 | + //delete the rcu pod |
| 855 | + assertDoesNotThrow(() -> deletePod("rcu", dbNamespace), |
| 856 | + "Got exception while deleting server " + "rcu"); |
| 857 | + checkPodDoesNotExist("rcu", null, dbNamespace); |
| 858 | + } |
| 859 | + |
727 | 860 | private File createWdtPropertyFile(String domainName, String rcuSchemaPrefix) {
|
728 | 861 |
|
729 | 862 | // create property file used with domain model file
|
@@ -851,6 +984,4 @@ private String getHostPath(String pvName, String className) {
|
851 | 984 | Path hostPVPath = createPVHostPathDir(pvName, className);
|
852 | 985 | return hostPVPath.toString();
|
853 | 986 | }
|
854 |
| - |
855 | 987 | }
|
856 |
| - |
|
0 commit comments