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
Standardize naming in generic storage watcher tests #113721
Standardize naming in generic storage watcher tests #113721
Conversation
@@ -44,65 +44,76 @@ func RunTestWatch(ctx context.Context, t *testing.T, store storage.Interface) { | |||
// - update should trigger Modified event | |||
// - update that gets filtered should trigger Deleted event | |||
func testWatch(ctx context.Context, t *testing.T, store storage.Interface, recursive bool) { | |||
podFoo := &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo"}} | |||
podBar := &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "bar"}} | |||
basePod := &example.Pod{ |
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.
e903edc
to
7510d5c
Compare
7510d5c
to
593742f
Compare
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: stevekuznetsov, wojtek-t 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 |
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.
/lgtm
watchKey := fmt.Sprintf("pods/%s", tt.namespace) | ||
key := watchKey + "/foo" | ||
if !recursive { | ||
watchKey = key | ||
} | ||
|
||
w, err := store.Watch(ctx, watchKey, storage.ListOptions{ResourceVersion: "0", Predicate: tt.pred, Recursive: recursive}) |
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.
nice this is way more readable
key := tt.key | ||
if recursive { | ||
key = key + "/item" | ||
} |
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 always hated this bit.
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.
:)
/milestone v1.26 [This was tagged before code-freeze, and in addition this is test-only change.] |
/triage accepted |
Ref #109831
/kind cleanup
/priority important-longterm
/sig api-machinery
/assign @stevekuznetsov
/cc @tallclair