-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix 1680: Usage of nonexistent namespace in cronjob example tests #1681
Conversation
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.
/approve
It shows great 👍
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, gabbifish 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 |
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 tested it with the PR to update the doc samples: https://github.com/kubernetes-sigs/kubebuilder/pull/1681/files
All worked see:
camilamacedo@Camilas-MacBook-Pro ~/go/src/sigs.k8s.io/kubebuilder/docs/book/src/cronjob-tutorial/testdata/project (update-docs-tes-fix) $ make test
/Users/camilamacedo/go/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
go fmt ./...
go vet ./...
/Users/camilamacedo/go/bin/controller-gen "crd:trivialVersions=true" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
mkdir -p /Users/camilamacedo/go/src/sigs.k8s.io/kubebuilder/docs/book/src/cronjob-tutorial/testdata/project/testbin
test -f /Users/camilamacedo/go/src/sigs.k8s.io/kubebuilder/docs/book/src/cronjob-tutorial/testdata/project/testbin/setup-envtest.sh || curl -sSLo /Users/camilamacedo/go/src/sigs.k8s.io/kubebuilder/docs/book/src/cronjob-tutorial/testdata/project/testbin/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/master/hack/setup-envtest.sh
source /Users/camilamacedo/go/src/sigs.k8s.io/kubebuilder/docs/book/src/cronjob-tutorial/testdata/project/testbin/setup-envtest.sh; fetch_envtest_tools /Users/camilamacedo/go/src/sigs.k8s.io/kubebuilder/docs/book/src/cronjob-tutorial/testdata/project/testbin; setup_envtest_env /Users/camilamacedo/go/src/sigs.k8s.io/kubebuilder/docs/book/src/cronjob-tutorial/testdata/project/testbin; go test ./... -coverprofile cover.out
fetching envtest [email protected] (into '/Users/camilamacedo/go/src/sigs.k8s.io/kubebuilder/docs/book/src/cronjob-tutorial/testdata/project/testbin')
x bin/
x bin/etcd
x bin/kubectl
x bin/kube-apiserver
setting up env vars
? tutorial.kubebuilder.io/project [no test files]
? tutorial.kubebuilder.io/project/api/v1 [no test files]
ok tutorial.kubebuilder.io/project/controllers 16.571s coverage: 40.3% of statements
/lgtm
This PR closes #1680. The cause of the bug was usage of a namespace that did not exist yet; in the test, we now use the
default
namespace that is guaranteed to exist without extra boilerplate logic. We also useprinter.NewlineReporter{}
consistent with this change in other kubebuilder code.