-
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
Potential propsoal: Include Kubernetes Gomega extension with to make testing controllers easier #933
Comments
This would be a great addition to controller-runtime /milestone v0.7.x |
/help |
@vincepri: Please ensure the request meets the requirements listed here. If this request no longer meets these requirements, the label can be removed 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. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale I'm hoping to get to this soon |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale Have added a WIP PR to implement an initial version of this |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
/remove-lifecycle rotten |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
FYI In Cluster API we implemented something similar, wondering if it makes sense to merge those efforts... |
I think having a generic central utility for this kind of thing makes sense, and the generic nature of the CAPI implementation of those matchers fits in with what I was envisioning here so totally up for including those as well if the community is happy to donate those to this effort |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closing this issue. 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. |
While building a number of controllers last year, a colleague and I came up with an extension to Gomega that allowed us to reduce a lot of boilerplate within our test suites. Our assertions ended up looking something like
To check that the node object eventually had a taint with the desired
Key
andEffect
. The benefit here being that we knew what we wanted to test in a particular test case, we wanted to see the controller adding this taint, we didn't care what the rest of the object looked like so comparing a whole object was out of the question. The act of fetching and creating the async assertion is all captured by the custom matcher we wrote and our transformationutils.WithField
allowed us to extract raw fields from any object passed so that we could use Gomega's core matching library to make asserations.For comparison, the code to check there's a taint for this object in raw Gomega would look something like
It has long been on my mind that contributing this Gomega extension upstream may be desirable so that others can make use of it, but I hadn't got around to posting yet.
So my question to the community is, does this look like something that could be useful? Is it something you want to know more about? Would a PR to add this kind of extension be accepted? I am happy to share more if there is interest in adding this kind of thing to the kubebuilder/controller-runtime project
The text was updated successfully, but these errors were encountered: