-
Notifications
You must be signed in to change notification settings - Fork 1.5k
✨ (go/v4): Add new makefile target to create a cluster name to run the e2e tests #4673
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
✨ (go/v4): Add new makefile target to create a cluster name to run the e2e tests #4673
Conversation
Hi @kersten. 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-sigs/prow repository. |
docs/book/src/cronjob-tutorial/testdata/project/.github/workflows/test-e2e.yml
Outdated
Show resolved
Hide resolved
e87b922
to
c24a8f2
Compare
exit 1; \ | ||
@$(KIND) get clusters | grep -q 'project-test-e2e' || { \ | ||
echo "Kind cluster not running, creating Kind cluster: project-test-e2e"; \ | ||
$(KIND) create cluster --name project-test-e2e --wait 5m; \ |
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 the cluster exist already it will fail, so should we not remove it.
I think we will need to clean it up as well, right?
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.
Great idea! We already have some cleanup logic in our code, I’ll add a dedicated target for it as we have. What do you think - should we clean it up automatically after each test, or just provide a target so it can be run manually? On our side, we usually clean it up manually to avoid long spin-up times during development.
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 think we will need something like
.PHONY: kind-clean
kind-clean:
$(KIND) delete cluster --name $(KIND_CLUSTER_NAME)
and call it at the end of the tests
Also, I think we do not need to check and instead only create the cluster nane
@$(KIND) get clusters | grep -q 'project-test-e2e' || { \
echo "Kind cluster not running, creating Kind cluster: project-test-e2e"; \
$(KIND) create cluster --name project-test-e2e --wait 5m; \
Can we also have an env var like the others for the cluster name?
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've added that already. And the variable was already requested in this PR: #4617. Could you recheck the changes? There ist a teardown-test-e2e target.
I'll add another change, so that it is execute after the test.
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.
Hi @kersten
I think the change looks good! We just need to make sure to clean up the cluster after the tests run.
Also, I hope you don’t mind—I updated the title of the PR to make it more suitable for the release notes.
/ok-to-test |
c24a8f2
to
5f5eb82
Compare
5f5eb82
to
d48303b
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.
Hi @kersten,
I'm OK with the proposed changes — I think it's a good addition to the default scaffolds.
I just added a couple of minor suggestions:
a) Use KIND_CLUSTER_NAME
to parameterize the cluster name used in the tests
b) Simplify the code by removing the extra check
Thanks for the contribution! 🎉
06253d9
to
61a967e
Compare
03ba85e
to
4acb07d
Compare
docs/book/src/cronjob-tutorial/testdata/project/test/utils/utils.go
Outdated
Show resolved
Hide resolved
4acb07d
to
d131e27
Compare
e853a8d
to
4aac705
Compare
KIND_CLUSTER=$(KIND_CLUSTER) go test ./test/e2e/ -v -ginkgo.v | ||
$(MAKE) teardown-test-e2e | ||
|
||
.PHONY: teardown-test-e2e |
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.
After reviewing possible naming options, it seems that cleanup-test-e2e is the most suitable choice.
It aligns well with the existing setup-test-e2e and test-e2e targets, keeping the naming consistent and intuitive. It also clearly communicates its purpose without being overly verbose or ambiguous.
Let me know if you'd prefer a different naming style, but this feels like the most balanced option for now.
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.
Hi @kersten 👋
Thank you so much for this change, and sorry for the delay in reviewing it!
After going through everything, I believe we're definitely good to move forward — just two small nitpicks to address before merging:
-
Revert the unnecessary change in the
scaffolds
method underutils
, so that for now we keep only the Makefile improvements.
👉 See: https://github.com/kubernetes-sigs/kubebuilder/pull/4673/files#r2030095359 -
Consider renaming the e2e cleanup test target to
cleanup-test-e2e
instead ofteardown-test-e2e
.
I think it would simplify the name and align better with the existing naming conventions.
👉 See: https://github.com/kubernetes-sigs/kubebuilder/pull/4673/files#r2030095626
Thanks again for the contribution — really appreciate the effort here! 🙌
1db61f0
to
37a0dd4
Compare
change default Kind cluster names to be project-specific for e2e tests Previously, the default Kind cluster name was "kind", which could lead to conflicts when running multiple e2e tests concurrently across different projects. This change updates the Kind cluster name to be project-specific, reducing potential conflicts and improving the isolation of e2e test environments.
37a0dd4
to
2bbb292
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.
Copilot reviewed 4 out of 15 changed files in this pull request and generated no comments.
Files not reviewed (11)
- docs/book/src/cronjob-tutorial/testdata/project/.github/workflows/test-e2e.yml: Language not supported
- docs/book/src/cronjob-tutorial/testdata/project/Makefile: Language not supported
- docs/book/src/getting-started/testdata/project/.github/workflows/test-e2e.yml: Language not supported
- docs/book/src/getting-started/testdata/project/Makefile: Language not supported
- docs/book/src/multiversion-tutorial/testdata/project/.github/workflows/test-e2e.yml: Language not supported
- docs/book/src/multiversion-tutorial/testdata/project/Makefile: Language not supported
- testdata/project-v4-multigroup/.github/workflows/test-e2e.yml: Language not supported
- testdata/project-v4-multigroup/Makefile: Language not supported
- testdata/project-v4-with-plugins/.github/workflows/test-e2e.yml: Language not supported
- testdata/project-v4-with-plugins/Makefile: Language not supported
- testdata/project-v4/Makefile: Language not supported
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.
It seems great for me 🥇
Thank you for your contribution
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, kersten 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 |
change default Kind cluster names to be project-specific for e2e tests
Previously, the default Kind cluster name was "kind", which could lead to conflicts when running multiple e2e tests concurrently across different projects. This change updates the Kind cluster name to be project-specific, reducing potential conflicts and improving the isolation of e2e test environments.