Skip to content

Conversation

maggiehe00
Copy link
Contributor

@maggiehe00 maggiehe00 commented Mar 25, 2019

  1. Adding tests for the changes of server/cluster scope properties that cause server pods to be restarted
  2. The properties being tested are: containerSecurityContext, podSecurityContext, resources
  3. Adding usecases to the README.md

The latest Jenkins clean run: http://****/view/weblogic-operator/job/weblogic-kubernetes-operator-javatest/1447/consoleFull

@maggiehe00
Copy link
Contributor Author

Because of the last "@maggiehe00
jenkins-ignore javadoc update" Jenkins weblogic-kubernetes-operator is aborted

@maggiehe00 maggiehe00 changed the title WIP: server scope podrestart-java-integ-test PR: server scope podrestart-java-integ-test Apr 1, 2019
@maggiehe00 maggiehe00 requested a review from anpanigr April 1, 2019 16:05
@maggiehe00 maggiehe00 changed the title PR: server scope podrestart-java-integ-test WIP: server scope podrestart-java-integ-test Apr 1, 2019
@maggiehe00 maggiehe00 changed the title WIP: server scope podrestart-java-integ-test PR: server scope podrestart-java-integ-test Apr 4, 2019
@maggiehe00 maggiehe00 changed the title PR: server scope podrestart-java-integ-test WIP: server scope podrestart-java-integ-test Apr 4, 2019
@maggiehe00 maggiehe00 changed the title WIP: server scope podrestart-java-integ-test PR: server scope podrestart-java-integ-test Apr 4, 2019
BaseTest.getUserProjectsDir() + "/weblogic-domains/" + domainUid + "/domain_new.yaml");

// append the file with changed property to the end of domain_new.yaml
TestUtils.concatFile(
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use Files.write(path, bytes, StandardOpenOption.APPEND);. Take a look at appendToDomainYamlAndCreate in Domain.java, you can refactor that if you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

// firstly ensure that original domain.yaml doesn't include the property-to-be-added
String domainFileName =
BaseTest.getUserProjectsDir() + "/weblogic-domains/" + domainUid + "/domain.yaml";
boolean result = TestUtils.checkFileIncludeProperty("fsGroup: 1000", domainFileName);
Copy link
Contributor

Choose a reason for hiding this comment

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

TestUtils.checkFileIncludeProperty("fsGroup: 1000", domainFileName);

can be replaced with

(new String(Files.readAllBytes(Paths.get(domainFileName)))).contains("fsGroup: 1000");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

logger.info("Inside findServerPropertyChange");
// get runtime server pod yaml file
String outDir = BaseTest.getUserProjectsDir() + "/weblogic-domains/" + domainUid + "/";
StringBuffer command = new StringBuffer();
Copy link
Contributor

Choose a reason for hiding this comment

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

As you are already executing a command, you can change it to

kubectl get pod <podname> -o yaml -n ns | grep changedProperty 

instead of saving the file and looking for a string later..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

* @throws Exception - IOException when file is copied or errors occurred if the tested server is
* not restarted
*/
public void testDomainServerPodRestart(String fileNameWithChangedProperty) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

change the method name to verifyDomainServerPodRestart or some such....we want to keep the test methods in IT classes or BaseTest.java

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

BaseTest.getUserProjectsDir() + "/weblogic-domains/" + domainUid + "/domain_new.yaml");

// kubectl apply the new constructed domain_new.yaml
TestUtils.kubectlapply(
Copy link
Contributor

Choose a reason for hiding this comment

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

You can call the existing TestUtils.exec()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@maggiehe00 maggiehe00 requested a review from vanajamukkara April 5, 2019 14:32
@maggiehe00
Copy link
Contributor Author

I'm going to sync to the latest develop branch and resolve integration-tests/README.md conflict.

@maggiehe00
Copy link
Contributor Author

@markxnelson @anpanigr Please kindly review the code. Thanks!

@anpanigr
Copy link
Member

anpanigr commented Apr 8, 2019

Approved

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.

Approved

@rjeberhard rjeberhard merged commit dec7312 into develop Apr 8, 2019
@rjeberhard rjeberhard deleted the podrestart-java-integ-test branch April 9, 2019 12:20
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.

4 participants