-
Notifications
You must be signed in to change notification settings - Fork 41k
Address refactoring TODOs in the test/utils module #133236
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
base: master
Are you sure you want to change the base?
Conversation
Hi @bxrne. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: bxrne 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 |
/priority backlog |
@ylink-lfs: The label(s) 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-sigs/prow repository. |
updateRetryInterval = 5 * time.Second | ||
updateRetryTimeout = 1 * time.Minute |
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.
I suggest adding a method doing exponential backoff retry and keeping the original updateRetryTimeout
and corresponding method untouched. Also, define these factors related to exponential backoff implementation inside the newly added utility func like ScaleResourceWithExponentialRetries
.
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.
Ok i tried adding a opt-in way of doing it.
test/utils/delete_resources.go
Outdated
func DeleteResource(c clientset.Interface, kind schema.GroupKind, namespace, name string, options metav1.DeleteOptions) error { | ||
ctx := context.TODO() |
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.
We should pass down the ctx
from top to bottom (in this case, the caller testutils.DeleteResource(c, kind, ns, name, metav1.DeleteOptions{PropagationPolicy: &background})
. Change the function signature of caller to allow it passing down). Your initialization break the context chain.
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.
understood 🫡
have adjusted and fixed references
test/utils/create_resources.go
Outdated
|
||
func CreatePodWithRetries(c clientset.Interface, ns string, pod *v1.Pod) error { | ||
return createWithRetries(func() (*v1.Pod, error) { | ||
return c.CoreV1().Pods(ns).Create(context.TODO(), pod, metav1.CreateOptions{}) |
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.
The same context chain break issue as I pointed out in delete_resources.go
/triage accepted |
…allers adjusted to follow suit
…th no breaking change
@bxrne: 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-sigs/prow repository. I understand the commands that are listed here. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
I grepped for TODOs and chose to address three in
./test/utils
.create_resources.go
createWithRetries
using a generic type to reduce the amount of codedelete_resources.go
ResourceDeleter
to allow deleter to be commonupdate_resources.go
scale.Scale()
Which issue(s) this PR is related to:
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: