-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
🐛 Fakeclient: Support WithWatch #1510
Conversation
When adding client.WithWatch, we forgot to extend the fakeclient to also support that, this change adds that support.
@alvaroaleman: The following test 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. |
Would it makes sense to just have Watch within the Client interface? |
I think that would confuse a lot of ppl and make them try to use that for getting cached data. In the context of a cache-backed client it would also result in establishing a second watch. The usecase for this are mainly CLIs that wait for an event to happen. |
Got it, that makes sense. Having the constructors to return a complete interface makes sense to me, although I wonder in that case if can also cause confusion. |
Yeah, that is what I was unsure about as well. Explicitly splitting here means three new constructors though. |
defer GinkgoRecover() | ||
// It is likely starting a new goroutine is slower than progressing | ||
// in the outer routine, sleep to make sure this is always true | ||
time.Sleep(100 * time.Millisecond) |
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.
Why not a channel or semaphore to enforce 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.
What we are waiting for is that the main routine starts to read, how would you sync that with a channel or semaphore?
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman, vincepri 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 |
When adding client.WithWatch, we forgot to extend the fakeclient to also
support that, this change adds that support.
/assign @vincepri
WDYT about changing the existing constructors to return a
client.WithWatch
vs adding a new set of constructors? I opted for extending them, because its easier to use, asclient.WithWatch
is a superset ofclient.Client
, so will work as a replacement for both.