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

Conversation

sankarpn
Copy link
Member

@sankarpn sankarpn commented Jun 26, 2020

Added tests to verify the overrideDistributionStrategy for configuration overrides.

The following tests are added.

  • For overrideDistributionStrategy with a DEFAULT settings(not values set for field)

  • For overrideDistributionStrategy with a DYNAMIC setting

  • For overrideDistributionStrategy with a ON_RESTART setting

  • For overrideDistributionStrategy with a RESTART setting - invalid value

Tests override config.xml and JDBC datasource entities and verifies the overrides are applied when overridesConfigMap is specified with a configmap containing override files.

Also verification is done whether the overrides files are removed from pods when overridesConfigMap is deleted from domain resource.

Test Result.

https://build.weblogick8s.org:8443/job/weblogic-kubernetes-operator-kind-new/616/testReport/oracle.weblogic.kubernetes/

https://build.weblogick8s.org:8443/job/weblogic-kubernetes-operator-kind-new/617/testReport/oracle.weblogic.kubernetes/

@sankarpn sankarpn requested a review from tbarnes-us July 1, 2020 19:52
Copy link
Member

@bhavaniravichandran bhavaniravichandran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

+ "{\"op\": \"add\",\"path\": \"/spec/clusters/-\", \"value\": "
+ " {\"clusterName\" : \"" + clusterName + "\", \"replicas\": 2, \"serverStartState\": \"RUNNING\"}"
+ "},"
+ "{\"op\": \"add\", \"path\": \"/spec/introspectVersion\", \"value\": \"4\"}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get the current Introspect version and bump it instead of hard-coding to 4

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Added a new utility method getNextIntrospectVersion to auto increment the introspectVersion.

assertTrue(patchDomainCustomResource(domainUid, domainNamespace, patch, V1Patch.PATCH_FORMAT_JSON_PATCH),
"Failed to patch domain");

//does changing overrideDistributionStrategy needs restart of server pods?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a TODO comment to make it visible

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a TODO comment

assertTrue(patchDomainCustomResource(domainUid, domainNamespace, patch, V1Patch.PATCH_FORMAT_JSON_PATCH),
"Failed to patch domain");

//does changing overrideDistributionStrategy needs restart of server pods?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add TODO Comments or the BUG/JIRA Number

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a TODO comment

* @param domainUid domain UID
* @throws IOException when creating pv path fails
*/
private void createPV(String pvName, String domainUid) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Common Test Utility candidate

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like Bhavani's comments I need to refactor some more classes to use methods from CommonTestUtils for the operations. Will do it in separate PR.

@sankarpn sankarpn requested a review from anpanigr July 1, 2020 23:48
Copy link
Member

@anpanigr anpanigr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tbarnes-us
Copy link

Hi Sankar - Is there a test that corresponds to the use case you described in your comment on Russ' latest candidate pull fix?

Namely: Have two override files in an overridesConfig map and verify they work. Then redeploy the cm where one is kept the same and the other's content is changed (while keeping the same name). Then change the introspectVersion, and verify (a) none of the servers 'rolled', (b) that the changed override file is taking effect, and finally (c) that the override from an unchanged override file is still taking effect.

content and applying the override through introspection
@sankarpn sankarpn marked this pull request as draft July 2, 2020 15:13
@sankarpn sankarpn changed the title Add tests for overrideDistributionStrategy Do not merge yet - Add tests for overrideDistributionStrategy Jul 2, 2020
@sankarpn sankarpn changed the title Do not merge yet - Add tests for overrideDistributionStrategy Add tests for overrideDistributionStrategy Jul 2, 2020
@sankarpn sankarpn self-assigned this Jul 2, 2020
@rjeberhard rjeberhard marked this pull request as ready for review July 2, 2020 18:43
@rjeberhard rjeberhard merged commit 94f7c7f into develop Jul 2, 2020
@sankarpn sankarpn deleted the distribution-strategy branch July 20, 2020 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants