Skip to content
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

Print Remediation Time in E2E Tests #111

Merged
merged 4 commits into from
Dec 14, 2023

Conversation

razo7
Copy link
Member

@razo7 razo7 commented Dec 12, 2023

Checking remediation time in e2e could help us identify slow remediations and identify if the PR changes impact the remediation time. We also calculate their average time for better understanding.

Checking remediation time in e2e could help us identify slow remediations and identify if the pr changes impact the remediations time. In addition there is no need to test pod creation time
Copy link
Contributor

openshift-ci bot commented Dec 12, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@razo7
Copy link
Member Author

razo7 commented Dec 12, 2023

/test 4.14-openshift-e2e
/test 4.15-openshift-e2e

Comment on lines 144 to 145
AfterEach(func() {
if len(remediationTimes) == 2 {
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 didn't find a better way to check that both tests are over. AfterAll didn't work for me (or I didn't use it properly).

Copy link
Contributor

Choose a reason for hiding this comment

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

If I read [1] correctly, AfterAll can only be used in Ordered containers, which cannot be randomized though, so considering the latest changes, it doesn't seem a viable option.

[1] https://onsi.github.io/ginkgo/#setup-in-ordered-containers-beforeall-and-afterall

Copy link
Member

Choose a reason for hiding this comment

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

have a look at AfterSuite

DeferCleanup(cleanupTestedResources, pod)

// set the node as "unhealthy" by disabling kubelet
makeNodeUnready(selectedNode)

startTime = time.Now()
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this is accurate enough. It is taking into account the time to create the object (which is variable) other than the actual initial instant of the remediation.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is taking into account the time to create the object (which is variable) other than the actual initial instant of the remediation.

Are you suggesting just "storing" the time after creating far CR (after line 131) instead of before the creation? I believe it is negligible, but I don't mind doing so

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking of getting the cr creation time, but you're right that the difference should be minimal

@razo7
Copy link
Member Author

razo7 commented Dec 13, 2023

/test 4.15-openshift-e2e

@clobrano
Copy link
Contributor

/lgtm
Giving others a chance to get more reviews (feel free to un-hold)
/hold

Comment on lines 144 to 145
AfterEach(func() {
if len(remediationTimes) == 2 {
Copy link
Member

Choose a reason for hiding this comment

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

have a look at AfterSuite

averageTimeDuration := 0.0
for index, remTime := range remediationTimes {
averageTimeDuration += remTime.Seconds()
fmt.Printf("\nRemediation time #%d: %s\n", index+1, remTime)
Copy link
Member

Choose a reason for hiding this comment

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

please use the logger log instead of fmt.Print

Copy link
Member Author

@razo7 razo7 Dec 13, 2023

Choose a reason for hiding this comment

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

I see that I have used fmt.Print in more places in the e2e test file, so I will update them all.

@razo7 razo7 force-pushed the print-remediation-time branch 2 times, most recently from f6886d8 to 0e20157 Compare December 13, 2023 12:16
AfterSuite is run after the whole suite is finished
@razo7
Copy link
Member Author

razo7 commented Dec 13, 2023

/retest

@@ -134,27 +135,28 @@ var _ = Describe("FAR E2e", func() {
When("running FAR to reboot two nodes", func() {
It("should successfully remediate the first node", func() {
checkRemediation(nodeName, nodeBootTimeBefore, pod)
remediationTimes = append(remediationTimes, time.Since(startTime))
remediationsTime = append(remediationsTime, time.Since(startTime))
Copy link
Member

Choose a reason for hiding this comment

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

hm, I think the old name was correct... 🤔
multiple times of a single remediation
this now sounds like overall time of all remediations

s/remediationsTime/remediationTimes
Copy link
Member

@slintes slintes left a comment

Choose a reason for hiding this comment

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

/retest
/hold cancel

Copy link
Contributor

openshift-ci bot commented Dec 14, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: razo7, slintes

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@razo7
Copy link
Member Author

razo7 commented Dec 14, 2023

/retest

@openshift-merge-bot openshift-merge-bot bot merged commit c75898b into medik8s:main Dec 14, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants