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

Skippable test scaffolding on create (api|webhook) #4509

Open
migueleliasweb opened this issue Jan 20, 2025 · 1 comment
Open

Skippable test scaffolding on create (api|webhook) #4509

migueleliasweb opened this issue Jan 20, 2025 · 1 comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@migueleliasweb
Copy link
Contributor

migueleliasweb commented Jan 20, 2025

What do you want to happen?

Context

Giving the ability to skip test creation would allow users who have diverged from the original test scaffolding without facing the error when creating new APIs.

Currently, it seems like the create api|webhook commands require the test/e2e/e2e_test.go to exist and they will also create a <kind>_test.go in every call.

When creating a new webhok after having moved the test/e2e/e2e_test.go files somewhere else, this error is shown:

FATA failed to create webhook: unable to scaffold with "base.go.kubebuilder.io/v4": open test/e2e/e2e_test.go: no such file or directory 

The current workaround is to create an empty file in that location, just so kubebuilder is happy enough to run the command.

Ps: I know the idea here is to create a plugin for kubebuilder but I don't quite have that need yet. It would be nice if I could just keep using the default scaffolding without having to have empty files laying around.

Proposal

My proposal is to create a --skip-test-scaffolding flag for create (api|webhook) calls.

Extra Labels

No response

@migueleliasweb migueleliasweb added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 20, 2025
@camilamacedo86
Copy link
Member

Hi @migueleliasweb

Thank you for raise this one. That is happing because we have markers for the tests now; https://github.com/kubernetes-sigs/kubebuilder/blob/master/testdata/project-v4/test/e2e/e2e_test.go#L316

But I agree 100%. In this case, we should WARNING and say that we are unable to scaffold e2e tests for webhooks since the path was not found.

Would you like to push a PR for this one?

@camilamacedo86 camilamacedo86 added kind/bug Categorizes issue or PR as related to a bug. priority/backlog Higher priority than priority/awaiting-more-evidence. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

2 participants