Skip to content

Add Integration Test to allow customization of successThreshold and failureThreshold in weblogic server liveness and readiness probe #2527

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 18 commits into from
Sep 17, 2021

Conversation

xiancao
Copy link
Member

@xiancao xiancao commented Sep 8, 2021

Add integration test to allow customization of successThreshold and failureThreshold in weblogic server liveness and readiness probe

Jenkins result:
https://build.weblogick8s.org:8443/view/all/job/weblogic-kubernetes-operator-kind-new/6445/
https://build.weblogick8s.org:8443/view/all/job/weblogic-kubernetes-operator-kind-new/6444/

Jenkins result for okd:
https://build.weblogick8s.org:8443/view/all/job/wko-okd-test/7/

}

/**
* Patch the domain with custom readinessProbe failureThreshold and successThreshold value in serverPod.
Copy link
Member

Choose a reason for hiding this comment

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

Does this test not cover earlier two test methods testCustomLivenessProbeSuccessThreshold() and testCustomLivenessProbeFailureThreshold() ?

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 check runtime behavior of these two new attributes ?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is for readinessProbe. The other two tests are for livenessProbe.
I will add the runtime check for this two attribute.

Copy link
Member

Choose a reason for hiding this comment

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

Can u not combine testCustomLivenessProbeSuccessThreshold() and testCustomLivenessProbeFailureThreshold() into a single test method testCustomLivenessProbeFailureThresholdSuccessThreshold()

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we can

@xiancao xiancao requested a review from anpanigr September 10, 2021 23:54
@@ -231,6 +242,324 @@ void testCustomLivenessProbeNotTrigged() {
}
}

/**
* Patch the domain with custom livenessProbe failureThreshold and successThreshold value in serverPod.
* Verify the domain is restarted and the failureThreshold and successThreshold is updated.
Copy link
Member

Choose a reason for hiding this comment

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

Description does not include runtime behavior check provided in the test


// check the pod should be restarted after 1m 30s since the livenessProbe periodSeconds defaults to 45s.
// sleep for 1m
try {
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 eliminate the 1m hard-code sleep, by reducing the LivenessProbe default to smaller vaule.

Copy link
Member Author

Choose a reason for hiding this comment

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

reduced the sleep time by change livenessProbe periodSeconds to smaller value.

@xiancao xiancao requested a review from anpanigr September 15, 2021 15:59
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

logger.info("livenessProbe failureThreshold after patch is: {0}", failureThreshold);
assertTrue(failureThreshold.intValue() == 3, "The livenessProbe failureThreshold after patch is not 3");

// get the successThreshold of livenessProbe after patch
Copy link
Member

Choose a reason for hiding this comment

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

Probably this check is not necessary since the successThreshold is not patched and value didn't change.

Copy link
Member Author

Choose a reason for hiding this comment

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

removed this check

@@ -114,6 +126,11 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {

// create a basic model in image domain
createAndVerifyMiiDomain(imageName);

// create temp file
String fileName = "tempFile";
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure what the temp file is used for. Perhaps the name of the file can be changed to make its purpose more clear and/or comments should be updated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the comments. This file is also used by other tests in the suite.

logger.info("For server {0} restart count before liveness probe is: {1}",
managedServerPodName, beforeRestartCount);

String destLocation = "/u01/tempFile.txt";
Copy link
Member

Choose a reason for hiding this comment

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

Instead of copying the file, maybe the test can run a command such as "touch /u01/tempFile.txt" or `echo "Test" > /u01/tempFile.txt" inside the pod to create the file.

Copy link
Member Author

Choose a reason for hiding this comment

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

I just reused the method in the other tests.

} catch (InterruptedException ie) {
// ignore
}
int after1mRestartCount =
Copy link
Member

Choose a reason for hiding this comment

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

Since the sleep value is reduced to 45 seconds, probably this variable name needs to be changed to something like afterDelayRestartCount .

Copy link
Member Author

Choose a reason for hiding this comment

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

updated the variable name.

@xiancao xiancao requested a review from ankedia September 16, 2021 18:41
Copy link
Member

@ankedia ankedia left a comment

Choose a reason for hiding this comment

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

LGTM

@rjeberhard rjeberhard merged commit 5b9746a into main Sep 17, 2021
@xiancao xiancao deleted the xc-91861 branch September 17, 2021 16:04
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