-
Notifications
You must be signed in to change notification settings - Fork 25
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
✨ Add controllers tests for real Reconcile loop running with setup-envtest #150
✨ Add controllers tests for real Reconcile loop running with setup-envtest #150
Conversation
Hi @dmvolod. Thanks for your PR. I'm waiting for a kubernetes-sigs 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/test-infra repository. |
/ok-to-test Still working on e2e tests (like in #163) so please be patient! |
8a52504
to
98ca9c1
Compare
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 contribution! Here's a first pass with comments, will circle back for a more thorough review.
Makefile
Outdated
@@ -264,6 +264,11 @@ generate-modules: ## Run go mod tidy to ensure modules are up to date | |||
go mod tidy | |||
cd $(TOOLS_DIR); go mod tidy | |||
|
|||
.PHONY: download-cluster-api-crd | |||
download-cluster-api-crd: generate-modules ## Run to download Cluster API CRDs for tests | |||
cp -r $(shell go env GOPATH)/pkg/mod/sigs.k8s.io/cluster-api@$(shell go list -f "{{.Version}}" -m sigs.k8s.io/cluster-api)/config/crd/bases/cluster.x-k8s.io_clusters.yaml ./controllers/testdata/crd |
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.
Should we add a CAPI version pin in the Makefile since the CAPI version is already pinned in go.mod?
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.
Yes, originally I used this approach (CLUSTER_API_VERSION variable in Makefile), but current approach avoids to keep it and changing every time Clusrer API changing in go.mod
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.
Fixed it with introducing CLUSTER_API_VERSION := $(call get_go_version,sigs.k8s.io/cluster-api)
variable. Also tune get_go_version
a bit without awk
utilization and native golang format approach.
98ca9c1
to
3cf1211
Compare
@@ -438,3 +444,9 @@ func TestReconcileDelete(t *testing.T) { | |||
}) | |||
} | |||
} | |||
|
|||
func init() { |
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 is this needed in for the unit tests in this file?
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.
As unit-tests utilizingfake.NewClientBuilder()
it requires scheme's to be registered.
42bb1a1
to
1b6fae3
Compare
1b6fae3
to
2e79336
Compare
Thanks for the contribution! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dmvolod, Jont828 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 |
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #146