-
Notifications
You must be signed in to change notification settings - Fork 296
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
🌱 Setup separate context for test files to avoid flaky errors #2462
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
25028d6
to
f82c007
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2462 +/- ##
==========================================
- Coverage 63.63% 63.34% -0.29%
==========================================
Files 122 122
Lines 8753 8753
==========================================
- Hits 5570 5545 -25
- Misses 2773 2791 +18
- Partials 410 417 +7 ☔ View full report in Codecov by Sentry. |
f82c007
to
574b48c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/retest
@@ -17,6 +17,7 @@ limitations under the License. | |||
package controllers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move the package-level ctx in controllers_suite_test.go into the setup func.
This way we ensure nobody is reusing it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, I'm not sure I understand how the package-level context can lead to flaky tests. It should be only canceled when the test process is killed. Are there more details on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. If I find the time I try to reproduce. Would be just interesting to understand why. I'm not sure but could be that we should re-think the pattern of using a package-level ctx. I think we use it in a bunch of places in core CAPI (but not sure)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It only can be reproduced in prow test, I cannot reproduce it locally, so not sure about the root cause.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's okay I would hold this PR for now. I'm hesitant to make this change if we don't know why we need it and tests are stable without this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's OK for me to hold it until we reproduce it, this PR is just to make test cases more isolated considering the context staff.
Signed-off-by: Gong Zhang <gongz@vmware.com>
574b48c
to
08f5135
Compare
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Related to #2506 (I think) |
Let's hold this work until we are sure about why it happened in https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/compare/269023424b03a8c029ad95b605f0b6bf9431f9a3..b00e9811fd246af7a9e03676d9577b8ef56106d0 and if this would bring a benefit at all /hold |
@zhanggbj: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
I think we don't need this anymore. /close |
@chrischdi: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What this PR does / why we need it:
Setup separate context for test files under /controllers instead of using the test-package context, this is to avoid flaky errors we found in CI.
Please find more details in #2295
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Part of #2295