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

🐛 Fakeclient: Support WithWatch #1510

Merged
merged 1 commit into from May 5, 2021

Conversation

alvaroaleman
Copy link
Member

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, as client.WithWatch is a superset of client.Client, so will work as a replacement for both.

When adding client.WithWatch, we forgot to extend the fakeclient to also
support that, this change adds that support.
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 4, 2021
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 4, 2021
@k8s-ci-robot
Copy link
Contributor

@alvaroaleman: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-controller-runtime-apidiff-master 2a2f6b4 link /test pull-controller-runtime-apidiff-master

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.

@vincepri
Copy link
Member

vincepri commented May 4, 2021

Would it makes sense to just have Watch within the Client interface?

@alvaroaleman
Copy link
Member Author

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.

@vincepri
Copy link
Member

vincepri commented May 4, 2021

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.

@alvaroaleman
Copy link
Member Author

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)
Copy link
Contributor

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?

Copy link
Member Author

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?

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 5, 2021
@k8s-ci-robot
Copy link
Contributor

[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:
  • OWNERS [alvaroaleman,vincepri]

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

@k8s-ci-robot k8s-ci-robot merged commit d63cfde into kubernetes-sigs:master May 5, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.9.x milestone May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants