-
Notifications
You must be signed in to change notification settings - Fork 216
create wls-srg profile for a minimal wko certification #2767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
1d08f2e
create wls-srg profile
xiancao eb41716
add wls-srg profile
xiancao 92a05d6
create wls-srg profile
xiancao 98c7818
get the latest release/3.3
xiancao bb61261
cleanup
xiancao de86c9f
resolve merge conflicts
xiancao 45d7f3c
fix syntax error
xiancao dea42d3
restore jenkinsScript.sh
xiancao 1e4515b
Merge branch 'release/3.3' of https://github.com/oracle/weblogic-kube…
xiancao c1520a8
add more tests to wls-srg
xiancao 0a778cd
add more tests to wls-srg
xiancao a0f206f
get latest release/3.3
xiancao 4d87885
add more tests to wls-srg
xiancao e9febd2
Merge branch 'release/3.3' of https://github.com/oracle/weblogic-kube…
xiancao 06a19fc
fix class name
xiancao 304fa44
Merge branch 'release/3.3' of https://github.com/oracle/weblogic-kube…
xiancao 5c5830d
address Pani's comments
xiancao bd91529
update copyright
xiancao 9df7b1a
address Pani's comments
xiancao 2c4e33f
Merge branch 'release/3.3' of https://github.com/oracle/weblogic-kube…
xiancao b884a2e
address Pani's comments
xiancao 50a41ab
address Vanaja's comments
xiancao b444e69
Merge branch 'release/3.3' of https://github.com/oracle/weblogic-kube…
xiancao 9b68d68
cleanup
xiancao 0ef3cc9
address Pani's comments
xiancao e3e07d8
address Pani's comments
xiancao b90f360
address Vanaja's comments
xiancao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
200 changes: 200 additions & 0 deletions
200
integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMultiDomainModels.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,200 @@ | ||
| // Copyright (c) 2022, Oracle and/or its affiliates. | ||
| // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. | ||
|
|
||
| package oracle.weblogic.kubernetes; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| import oracle.weblogic.domain.Domain; | ||
| import oracle.weblogic.kubernetes.annotations.IntegrationTest; | ||
| import oracle.weblogic.kubernetes.annotations.Namespaces; | ||
| import oracle.weblogic.kubernetes.logging.LoggingFacade; | ||
| import org.junit.jupiter.api.BeforeAll; | ||
| import org.junit.jupiter.api.DisplayName; | ||
| import org.junit.jupiter.params.ParameterizedTest; | ||
| import org.junit.jupiter.params.provider.ValueSource; | ||
|
|
||
| import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT; | ||
| import static oracle.weblogic.kubernetes.TestConstants.ADMIN_SERVER_NAME_BASE; | ||
| import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT; | ||
| import static oracle.weblogic.kubernetes.TestConstants.MANAGED_SERVER_NAME_BASE; | ||
| import static oracle.weblogic.kubernetes.TestConstants.MII_BASIC_APP_NAME; | ||
| import static oracle.weblogic.kubernetes.TestConstants.MII_BASIC_IMAGE_NAME; | ||
| import static oracle.weblogic.kubernetes.TestConstants.MII_BASIC_IMAGE_TAG; | ||
| import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_SLIM; | ||
| import static oracle.weblogic.kubernetes.actions.TestActions.getServiceNodePort; | ||
| import static oracle.weblogic.kubernetes.assertions.TestAssertions.adminNodePortAccessible; | ||
| import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.createMiiDomainAndVerify; | ||
| import static oracle.weblogic.kubernetes.utils.CommonTestUtils.scaleAndVerifyCluster; | ||
| import static oracle.weblogic.kubernetes.utils.DomainUtils.createAndVerifyDomainInImageUsingWdt; | ||
| import static oracle.weblogic.kubernetes.utils.DomainUtils.createDomainOnPvUsingWdt; | ||
| import static oracle.weblogic.kubernetes.utils.DomainUtils.shutdownDomainAndVerify; | ||
| import static oracle.weblogic.kubernetes.utils.OperatorUtils.installAndVerifyOperator; | ||
| import static oracle.weblogic.kubernetes.utils.PodUtils.getExternalServicePodName; | ||
| import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger; | ||
| import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; | ||
| import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||
| import static org.junit.jupiter.api.Assumptions.assumeFalse; | ||
|
|
||
| /** | ||
| * The test class creates WebLogic domains with three models. | ||
| * domain-on-pv ( using WDT ) | ||
| * domain-in-image ( using WDT ) | ||
| * model-in-image | ||
| * Verify the basic lifecycle operations of the WebLogic server pods by scaling the domain. | ||
| * Also verify admin console login using admin node port. | ||
| */ | ||
| @DisplayName("Verify the basic lifecycle operations of the WebLogic server pods by scaling the clusters in the domain" | ||
| + " with different domain types and verify admin console login using admin node port.") | ||
| @IntegrationTest | ||
| class ItMultiDomainModels { | ||
|
|
||
| // domain constants | ||
| private static final String clusterName = "cluster-1"; | ||
| private static final int replicaCount = 2; | ||
| private static final String wlSecretName = "weblogic-credentials"; | ||
| private static final String miiDomainUid = "miidomain"; | ||
| private static final String dimDomainUid = "domaininimage"; | ||
| private static final String dpvDomainUid = "domainonpv"; | ||
| private static final String wdtModelFileForDomainInImage = "wdt-singlecluster-sampleapp-usingprop-wls.yaml"; | ||
|
|
||
| private static LoggingFacade logger = null; | ||
| private static String miiDomainNamespace = null; | ||
| private static String domainOnPVNamespace = null; | ||
| private static String domainInImageNamespace = null; | ||
|
|
||
| /** | ||
| * Install operator. | ||
| * Create three different type of domains: model in image, domain on PV and domain in image. | ||
| * | ||
| * @param namespaces list of namespaces created by the IntegrationTestWatcher by the | ||
| * JUnit engine parameter resolution mechanism | ||
| */ | ||
| @BeforeAll | ||
| public static void initAll(@Namespaces(4) List<String> namespaces) { | ||
| logger = getLogger(); | ||
|
|
||
| // get a unique operator namespace | ||
| logger.info("Getting a unique namespace for operator"); | ||
| assertNotNull(namespaces.get(0), "Namespace list is null"); | ||
| String opNamespace = namespaces.get(0); | ||
|
|
||
| // get unique namespaces for three different type of domains | ||
| logger.info("Getting unique namespaces for three different type of domains"); | ||
| assertNotNull(namespaces.get(1)); | ||
| miiDomainNamespace = namespaces.get(1); | ||
| assertNotNull(namespaces.get(2)); | ||
| domainOnPVNamespace = namespaces.get(2); | ||
| assertNotNull(namespaces.get(3)); | ||
| domainInImageNamespace = namespaces.get(3); | ||
|
|
||
| // set the service account name for the operator | ||
| String opServiceAccount = opNamespace + "-sa"; | ||
|
|
||
| // install and verify operator | ||
| installAndVerifyOperator(opNamespace, opServiceAccount, false, 0, | ||
| miiDomainNamespace, domainOnPVNamespace, domainInImageNamespace); | ||
| } | ||
|
|
||
| /** | ||
| * Scale the cluster by patching domain resource for three different | ||
| * type of domains i.e. domain-on-pv, domain-in-image and model-in-image | ||
| * Also verify admin console login using admin node port. | ||
| * @param domainType domain type, possible value: modelInImage, domainInImage, domainOnPV | ||
| */ | ||
| @ParameterizedTest | ||
| @DisplayName("scale cluster by patching domain resource with three different type of domains and " | ||
| + "verify admin console login using admin node port.") | ||
| @ValueSource(strings = {"modelInImage", "domainInImage", "domainOnPV"}) | ||
| void testScaleClustersAndAdminConsoleLogin(String domainType) { | ||
|
|
||
| assumeFalse(WEBLOGIC_SLIM, "Skipping the Console Test for slim image"); | ||
| Domain domain = createDomainBasedOnDomainType(domainType); | ||
|
|
||
| // get the domain properties | ||
| String domainUid = domain.getSpec().getDomainUid(); | ||
| String domainNamespace = domain.getMetadata().getNamespace(); | ||
|
|
||
| String managedServerPodNamePrefix = domainUid + "-" + MANAGED_SERVER_NAME_BASE; | ||
|
|
||
| int numberOfServers = 3; | ||
| logger.info("Scaling cluster {0} of domain {1} in namespace {2} to {3} servers.", | ||
| clusterName, domainUid, domainNamespace, numberOfServers); | ||
| List<String> managedServersBeforeScale = listManagedServersBeforeScale(replicaCount); | ||
| scaleAndVerifyCluster(clusterName, domainUid, domainNamespace, managedServerPodNamePrefix, | ||
| replicaCount, numberOfServers, null, managedServersBeforeScale); | ||
|
|
||
| // then scale cluster back to 2 servers | ||
| logger.info("Scaling cluster {0} of domain {1} in namespace {2} from {3} servers to {4} servers.", | ||
| clusterName, domainUid, domainNamespace, numberOfServers, replicaCount); | ||
| managedServersBeforeScale = listManagedServersBeforeScale(numberOfServers); | ||
| scaleAndVerifyCluster(clusterName, domainUid, domainNamespace, managedServerPodNamePrefix, | ||
| numberOfServers, replicaCount, null, managedServersBeforeScale); | ||
|
|
||
| String adminServerPodName = domainUid + "-" + ADMIN_SERVER_NAME_BASE; | ||
| logger.info("Getting node port for default channel"); | ||
| int serviceNodePort = assertDoesNotThrow(() -> getServiceNodePort( | ||
| domainNamespace, getExternalServicePodName(adminServerPodName), "default"), | ||
| "Getting admin server node port failed"); | ||
|
|
||
| logger.info("Validating WebLogic admin server access by login to console"); | ||
| boolean loginSuccessful = assertDoesNotThrow(() -> | ||
| adminNodePortAccessible(serviceNodePort, ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT), | ||
| "Access to admin server node port failed"); | ||
| assertTrue(loginSuccessful, "Console login validation failed"); | ||
|
|
||
| // shutdown domain and verify the domain is shutdown | ||
| shutdownDomainAndVerify(domainNamespace, domainUid, replicaCount); | ||
| } | ||
|
|
||
| /** | ||
| * Generate a server list which contains all managed servers in the cluster before scale. | ||
| * | ||
| * @param replicasBeforeScale the replicas of WebLogic cluster before scale | ||
| * @return list of managed servers in the cluster before scale | ||
| */ | ||
| private static List<String> listManagedServersBeforeScale(int replicasBeforeScale) { | ||
|
|
||
| List<String> managedServerNames = new ArrayList<>(); | ||
| for (int i = 1; i <= replicasBeforeScale; i++) { | ||
| managedServerNames.add(MANAGED_SERVER_NAME_BASE + i); | ||
| } | ||
|
|
||
| return managedServerNames; | ||
| } | ||
|
|
||
| /** | ||
| * Assert the specified domain and domain spec, metadata and clusters not null. | ||
| * @param domain oracle.weblogic.domain.Domain object | ||
| */ | ||
| private static void assertDomainNotNull(Domain domain) { | ||
| assertNotNull(domain, "domain is null"); | ||
| assertNotNull(domain.getSpec(), domain + " spec is null"); | ||
| assertNotNull(domain.getMetadata(), domain + " metadata is null"); | ||
| assertNotNull(domain.getSpec().getClusters(), domain.getSpec() + " getClusters() is null"); | ||
| } | ||
|
|
||
| private static Domain createDomainBasedOnDomainType(String domainType) { | ||
| Domain domain = null; | ||
|
|
||
| if (domainType.equalsIgnoreCase("modelInImage")) { | ||
| domain = createMiiDomainAndVerify(miiDomainNamespace, miiDomainUid, | ||
| MII_BASIC_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG, | ||
| miiDomainUid + "-" + ADMIN_SERVER_NAME_BASE, | ||
| miiDomainUid + "-" + MANAGED_SERVER_NAME_BASE, replicaCount); | ||
| } else if (domainType.equalsIgnoreCase("domainInImage")) { | ||
| List<String> appSrcDirList = new ArrayList<>(); | ||
| appSrcDirList.add(MII_BASIC_APP_NAME); | ||
| domain = createAndVerifyDomainInImageUsingWdt(dimDomainUid, domainInImageNamespace, | ||
| wdtModelFileForDomainInImage, appSrcDirList, wlSecretName, clusterName, replicaCount); | ||
| } else { | ||
| domain = createDomainOnPvUsingWdt(dpvDomainUid, domainOnPVNamespace, wlSecretName, | ||
| clusterName, replicaCount, ItMultiDomainModels.class.getSimpleName()); | ||
| } | ||
|
|
||
| assertDomainNotNull(domain); | ||
| return domain; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.