Skip to content

Add tests for overrideDistributionStrategy #1768

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 114 commits into from
Jul 2, 2020
Merged
Changes from 1 commit
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
6d4dc6e
Adding config distribution strategy tests
sankarpn Jun 15, 2020
d73dff2
Adding distribution stratgey test
sankarpn Jun 16, 2020
b29447a
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernet…
sankarpn Jun 16, 2020
d44a7a1
Adding configmap in patch string
sankarpn Jun 17, 2020
2d38d88
fix configmap name
sankarpn Jun 17, 2020
9c41c52
wip
sankarpn Jun 18, 2020
af9ef4e
wip
sankarpn Jun 18, 2020
8972fc6
wip
sankarpn Jun 18, 2020
160bc5d
patch the domain after config change
sankarpn Jun 18, 2020
53aaa55
Merge branch 'develop' into distribution-strategy
sankarpn Jun 22, 2020
1f41172
adding test with distributionstrategy as DYNAMIC
sankarpn Jun 22, 2020
46c75e0
increment the introspect version
sankarpn Jun 23, 2020
52a8a14
Merge branch 'develop' into distribution-strategy
sankarpn Jun 23, 2020
a1f2e2e
Added more test scenarios
sankarpn Jun 23, 2020
988a864
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernet…
sankarpn Jun 23, 2020
d32301e
Add configuration property reader servlet
sankarpn Jun 23, 2020
0f31ff9
Deploy the application right after creating domain
sankarpn Jun 23, 2020
ba30d60
Formatting
sankarpn Jun 23, 2020
fcf5968
change the attribute value
sankarpn Jun 23, 2020
4315b65
wip
sankarpn Jun 23, 2020
6d3a6bf
add a restart method
sankarpn Jun 23, 2020
be88905
Fix formatting
sankarpn Jun 23, 2020
0283096
Add the patching
sankarpn Jun 23, 2020
5758226
Fix pod check
sankarpn Jun 23, 2020
4774723
Get the pod creation timestamp after restart
sankarpn Jun 23, 2020
f03f35d
move the podready after startdomain
sankarpn Jun 23, 2020
1b97bb8
wip
sankarpn Jun 24, 2020
73d6581
wip
sankarpn Jun 24, 2020
c223ed3
Adding data source related tests
sankarpn Jun 24, 2020
bb16120
wip
sankarpn Jun 24, 2020
d1d9801
wip
sankarpn Jun 25, 2020
fc0e40e
wip
sankarpn Jun 25, 2020
7fa19d3
wip
sankarpn Jun 25, 2020
1c63708
wip
sankarpn Jun 25, 2020
05a1c68
wip
sankarpn Jun 25, 2020
239b457
override datasource with new url and user/password
sankarpn Jun 25, 2020
c61c598
remove open option
sankarpn Jun 25, 2020
96857c2
add secrets in the configuration
sankarpn Jun 25, 2020
6bb31c6
correct the path for secrets
sankarpn Jun 25, 2020
1aed77c
Print jdbc data source attributes
sankarpn Jun 25, 2020
1b8d57c
add checks for jdbc ds params
sankarpn Jun 25, 2020
63c0cbe
move verify overrides to separate method
sankarpn Jun 25, 2020
b85e41d
Refactor and cleanup code
sankarpn Jun 25, 2020
27abfe7
fix t3channelport for domain
sankarpn Jun 25, 2020
c5aad6c
lookup jdbc resource mbean from runtimeservicembean
sankarpn Jun 25, 2020
2d8671c
Fix the attribute values
sankarpn Jun 25, 2020
4fd1604
fix url
sankarpn Jun 25, 2020
c951d18
Refactor the code
sankarpn Jun 25, 2020
3ecee21
use static imports
sankarpn Jun 25, 2020
0e97438
Fix shutdown domain
sankarpn Jun 25, 2020
e350bf1
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernet…
sankarpn Jun 25, 2020
16114c8
Remove overrides and secrets when restoring domain
sankarpn Jun 25, 2020
974554f
Add a flag for debug printing
sankarpn Jun 25, 2020
385c384
Move the iintrospector check and pod state checks to separate methods
sankarpn Jun 26, 2020
558fa42
javadoc cleanup
sankarpn Jun 26, 2020
065aabb
Use static imports
sankarpn Jun 26, 2020
ce0512b
Fix typo
sankarpn Jun 26, 2020
714f76c
Move the copy operations in its own try/catch block to prevent build
sankarpn Jun 26, 2020
ed8b04d
Remove the override verifications since patching fails with invalid v…
sankarpn Jun 26, 2020
6d793e6
don't assert the patching in afterEach
sankarpn Jun 26, 2020
1ecd190
Introduced a dynamic wait until config is updated.
sankarpn Jun 26, 2020
4e26f90
Correct param index
sankarpn Jun 26, 2020
e951c36
Merge branch 'develop' into distribution-strategy
sankarpn Jun 26, 2020
2f2a8d3
Addressed Bhavani's review comments
sankarpn Jun 26, 2020
635b0fc
Addressing Marina's review comments
sankarpn Jun 26, 2020
927724e
liveness probe script 'copy new sit cfg' fix
Jun 29, 2020
a163a43
minor IT test fix - Always --> IfNotPresent
Jun 29, 2020
03dbacd
revert minor IT test fix - IfNotPresent goes back to Always, fix miss…
Jun 29, 2020
a2249bd
Adding a new cluster as part of override
sankarpn Jun 29, 2020
1f05d0b
add a test method for resource restart
sankarpn Jun 29, 2020
b181612
Restart datasource
sankarpn Jun 29, 2020
f2454e5
Split the patching into multiple parts
sankarpn Jun 29, 2020
4e0d5fa
Corrected the patch string, replicas should be a number not a string
sankarpn Jun 30, 2020
3a72941
Correct debug params
sankarpn Jun 30, 2020
42b5086
Correct typo
sankarpn Jun 30, 2020
c3ed95f
Refactor for new cluster
sankarpn Jun 30, 2020
6cf2c7f
Create second data source
sankarpn Jun 30, 2020
9777062
Fix listServers
sankarpn Jun 30, 2020
4868a93
Refactor the code to create new cluster through onliine WLST and brin…
sankarpn Jun 30, 2020
17b6d0e
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernet…
sankarpn Jun 30, 2020
51fe06b
add namespace for NGINX
sankarpn Jun 30, 2020
a581d7c
Fix typo
sankarpn Jun 30, 2020
fdc0ee2
correct typo
sankarpn Jun 30, 2020
c21658e
correct syntax error
sankarpn Jun 30, 2020
dec1abb
Fix string concat
sankarpn Jun 30, 2020
b5ce234
Uninstall NGINX
sankarpn Jun 30, 2020
c75666b
Move the confgi update check after new cluster startup verification
sankarpn Jun 30, 2020
07d4d7d
Add ingress controller
sankarpn Jun 30, 2020
6fc61ff
Fix nginx
sankarpn Jun 30, 2020
5685141
fix
sankarpn Jun 30, 2020
f47b108
Add all targets for application clusterview
sankarpn Jun 30, 2020
18a8fed
rename vars
sankarpn Jun 30, 2020
d0bb1c7
Separate adding the new cluster and config overrides into separate
sankarpn Jun 30, 2020
aed212d
Add a check for new servers
sankarpn Jun 30, 2020
1cc7026
fix imports
sankarpn Jun 30, 2020
8fc6391
Revert changes to ingress creation
sankarpn Jun 30, 2020
d9856fe
javadoc fix
sankarpn Jun 30, 2020
b51bba5
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernet…
sankarpn Jun 30, 2020
3ea3a41
move the for out of try catch
sankarpn Jun 30, 2020
e186cdc
put domainRuntime lookup inside try catch since it is only available in
sankarpn Jun 30, 2020
f6d7ed7
deploy app to admin server as well
sankarpn Jun 30, 2020
3549f6e
Provide a empty string to delete overridesconfigmap
sankarpn Jun 30, 2020
6d32c35
Remove everything under configuration
sankarpn Jun 30, 2020
9084157
move delete secrets to on_restart test
sankarpn Jun 30, 2020
21e01d1
cleanup comments
sankarpn Jul 1, 2020
a6448cd
change the secret name
sankarpn Jul 1, 2020
1a664d1
Disable the failing tests until bug
sankarpn Jul 1, 2020
ed1e738
Merge branch 'develop' into distribution-strategy
sankarpn Jul 1, 2020
307e5e3
Checking for the default token in default service account to fix the …
sankarpn Jul 1, 2020
a685a6b
Using a utlity method to increment the introspectVersion
sankarpn Jul 1, 2020
bcfecb1
Added a new test scenario where configmap is recreated with new override
sankarpn Jul 2, 2020
1abe452
Test fixes made based on the bug fix
sankarpn Jul 2, 2020
db55ed5
Fix secret name
sankarpn Jul 2, 2020
ccef0f1
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernet…
sankarpn Jul 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding configmap in patch string
  • Loading branch information
sankarpn committed Jun 17, 2020
commit d44a7a190c9aeb0269321b0cb68e296f7ea183eb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import oracle.weblogic.kubernetes.extensions.LoggedTest;
import oracle.weblogic.kubernetes.utils.BuildApplication;
import oracle.weblogic.kubernetes.utils.CommonTestUtils;
import oracle.weblogic.kubernetes.utils.OracleHttpClient;
import org.apache.commons.io.FileUtils;
import org.awaitility.core.ConditionFactory;
import org.joda.time.DateTime;
Expand All @@ -86,7 +85,6 @@
import static oracle.weblogic.kubernetes.TestConstants.OCR_USERNAME;
import static oracle.weblogic.kubernetes.TestConstants.PV_ROOT;
import static oracle.weblogic.kubernetes.actions.ActionConstants.APP_DIR;
import static oracle.weblogic.kubernetes.actions.ActionConstants.ITTESTS_DIR;
import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR;
import static oracle.weblogic.kubernetes.actions.ActionConstants.WLS_BASE_IMAGE_NAME;
import static oracle.weblogic.kubernetes.actions.ActionConstants.WLS_BASE_IMAGE_TAG;
Expand All @@ -96,7 +94,6 @@
import static oracle.weblogic.kubernetes.actions.TestActions.createPersistentVolumeClaim;
import static oracle.weblogic.kubernetes.actions.TestActions.getJob;
import static oracle.weblogic.kubernetes.actions.TestActions.getPodLog;
import static oracle.weblogic.kubernetes.actions.TestActions.getServiceNodePort;
import static oracle.weblogic.kubernetes.actions.TestActions.listPods;
import static oracle.weblogic.kubernetes.actions.TestActions.uninstallNginx;
import static oracle.weblogic.kubernetes.actions.impl.Domain.patchDomainCustomResource;
Expand All @@ -108,20 +105,14 @@
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReady;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkServiceExists;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createDomainAndVerify;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createIngressForDomainAndVerify;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createSecretWithUsernamePassword;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getPodCreationTime;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.installAndVerifyNginx;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.installAndVerifyOperator;
import static oracle.weblogic.kubernetes.utils.DeployUtil.deployUsingWlst;
import static oracle.weblogic.kubernetes.utils.TestUtils.getNextFreePort;
import static oracle.weblogic.kubernetes.utils.TestUtils.verifyClusterMemberCommunication;
import static oracle.weblogic.kubernetes.utils.WLSTUtils.executeWLSTScript;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.with;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
Expand Down Expand Up @@ -290,8 +281,7 @@ public void testDomainIntrospectVersionNotRolling() {
.spec(new DomainSpec()
.configuration(
new Configuration()
.overrideDistributionStrategy("DYNAMIC")
.overridesConfigMap(newConfigOverridemapName))
.overrideDistributionStrategy("DYNAMIC"))
.domainUid(domainUid)
.domainHome("/shared/domains/" + domainUid) // point to domain home in pv
.domainHomeSourceType("PersistentVolume") // set the domain home source type as pv
Expand Down Expand Up @@ -371,28 +361,16 @@ public void testDomainIntrospectVersionNotRolling() {
getPodCreationTime(introDomainNamespace, managedServerPodNamePrefix + i));
}

logger.info("change the cluster size and verify the introspector runs and updates the domain status");
// create a temporary WebLogic WLST property file
File wlstPropertiesFile = assertDoesNotThrow(() -> File.createTempFile("wlst", "properties"),
"Creating WLST properties file failed");
Properties p1 = new Properties();
p1.setProperty("admin_host", K8S_NODEPORT_HOST);
p1.setProperty("admin_port", Integer.toString(t3ChannelPort));
p1.setProperty("admin_username", ADMIN_USERNAME_DEFAULT);
p1.setProperty("admin_password", ADMIN_PASSWORD_DEFAULT);
p1.setProperty("cluster_name", clusterName);
p1.setProperty("max_cluster_size", Integer.toString(3));
p1.setProperty("test_name", "change_server_count");
assertDoesNotThrow(() -> p1.store(new FileOutputStream(wlstPropertiesFile), "wlst properties file"),
"Failed to write the WLST properties to file");

// change the server count of the cluster by running online WLST
Path configScript = Paths.get(RESOURCE_DIR, "python-scripts", "introspect_version_script.py");
executeWLSTScript(configScript, wlstPropertiesFile.toPath(), introDomainNamespace);

ArrayList<Path> configfiles = new ArrayList<>();
configfiles.add(Paths.get(RESOURCE_DIR, "configfiles/configoverridesset1/config.xml"));
configfiles.add(Paths.get(RESOURCE_DIR, "configfiles/configoverridesset1/version.txt"));
String override1cm = "configoverride1";
CommonTestUtils.createConfigMapFromFiles(override1cm, configfiles, introDomainNamespace);
// patch the domain to increase the replicas of the cluster and add introspectVersion field
String patchStr =
"["
+ "{\"op\": \"add\", \"path\": \"/spec/configuration/overridesConfigMap\", "
+ "\"value\": \"configoverride1\"},"
+ "{\"op\": \"add\", \"path\": \"/spec/introspectVersion\", \"value\": \"2\"}"
+ "]";

Expand Down Expand Up @@ -428,60 +406,6 @@ public void testDomainIntrospectVersionNotRolling() {
domainUid, introDomainNamespace, pods.get(i));
}

//create ingress controller
Map<String, Integer> clusterNameMsPortMap = new HashMap<>();
clusterNameMsPortMap.put(clusterName, managedServerPort);
logger.info("Creating ingress for domain {0} in namespace {1}", domainUid, introDomainNamespace);
createIngressForDomainAndVerify(domainUid, introDomainNamespace, clusterNameMsPortMap);

// deploy application and verify all servers functions normally
logger.info("Getting node port for T3 channel");
int t3channelNodePort = assertDoesNotThrow(()
-> getServiceNodePort(introDomainNamespace, adminServerPodName + "-external", "t3channel"),
"Getting admin server t3channel node port failed");
assertNotEquals(-1, t3ChannelPort, "admin server t3channelport is not valid");

//deploy application
Path archivePath = Paths.get(ITTESTS_DIR, "../src/integration-tests/apps/testwebapp.war");
logger.info("Deploying webapp to domain {0}", archivePath);
deployUsingWlst(K8S_NODEPORT_HOST, Integer.toString(t3channelNodePort),
ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, clusterName + "," + adminServerName, archivePath,
introDomainNamespace);

logger.info("Getting node port for default channel");
int serviceNodePort = assertDoesNotThrow(()
-> getServiceNodePort(introDomainNamespace, adminServerPodName + "-external", "default"),
"Getting admin server node port failed");

//access application from admin server
String url = "http://" + K8S_NODEPORT_HOST + ":" + serviceNodePort + "/testwebapp/index.jsp";
assertEquals(200,
assertDoesNotThrow(() -> OracleHttpClient.get(url, true),
"Accessing sample application on admin server failed")
.statusCode(), "Status code not equals to 200");


//deploy clusterview application
logger.info("Deploying clusterview app {0} to cluster {1}",
CLUSTERVIEW_APP_PATH, clusterName);
deployUsingWlst(K8S_NODEPORT_HOST, Integer.toString(t3channelNodePort),
ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, clusterName, CLUSTERVIEW_APP_PATH,
introDomainNamespace);

//access application in managed servers through NGINX load balancer
logger.info("Accessing the clusterview app through NGINX load balancer");
String curlRequest = String.format("curl --silent --show-error --noproxy '*' "
+ "-H 'host: %s' http://%s:%s/clusterview/ClusterViewServlet",
domainUid + "." + clusterName + ".test", K8S_NODEPORT_HOST, nodeportshttp);
List<String> managedServers = new ArrayList<>();
for (int i = 1; i <= replicaCount + 1; i++) {
managedServers.add(managedServerNameBase + i);
}
assertThat(verifyClusterMemberCommunication(curlRequest, managedServers, 20))
.as("Verify all managed servers can see each other")
.withFailMessage("managed servers cannot see other")
.isTrue();

}

/**
Expand Down