Skip to content

:sparkles Add env support for setting ErrorIfCRDPathMissing during testing #511

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

Conversation

connor1989
Copy link

A simpler interface for CRDInstallOptions.ErrorIfPathMissing. Adds ability to control, through the env, how errors are propagated when InstallCRDs is invoked with an invalid CRD path.

Closes #481

@k8s-ci-robot
Copy link
Contributor

Welcome @connor1989!

It looks like this is your first PR to kubernetes-sigs/controller-runtime 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/controller-runtime has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 2, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: connor1989
To complete the pull request process, please assign pwittrock
You can assign the PR to them by writing /assign @pwittrock in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 2, 2019
@connor1989 connor1989 changed the title Add env support for setting ErrorIfCRDPathMissing during testing :sparkles :sparkles Add env support for setting ErrorIfCRDPathMissing during testing Jul 2, 2019
@connor1989
Copy link
Author

/assign @pwittrock

@k8s-ci-robot
Copy link
Contributor

@connor1989: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

Copy link
Contributor

@DirectXMan12 DirectXMan12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't actually appear to have changed anything -- it added an option, but that option isn't used anywhere

@@ -58,10 +58,28 @@ var _ = Describe("Test", func() {
})

Describe("InstallCRDs", func() {

It("should set ErrorIfCRDPathMissing through env settings", func(done Done) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's unclear to me what this is testing, since it doesn't seem to be testing that the setting gets automatically propogated from Environment to InstallCRDs

Copy link
Author

@connor1989 connor1989 Jul 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it only validates the new option. This was to keep the other tests unchanged here.
https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/envtest/envtest_test.go#L155

My other thought was to make this change directly in BeforeSuite and update all the tests accordingly.

var _ = BeforeSuite(func(done Done) {
	logf.SetLogger(zap.LoggerTo(GinkgoWriter, true))
	env = &Environment{
++   	    ErrorIfCRDPathMissing: true,
        }
	_, err := env.Start()

Any opposition to this?

It("should install the CRDs into the cluster", func(done Done) {

crds, err = InstallCRDs(env.Config, CRDInstallOptions{
Paths: []string{filepath.Join(".", "testdata")},
Paths: []string{filepath.Join(".", "testdata")},
ErrorIfPathMissing: env.ErrorIfCRDPathMissing,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DirectXMan12 to your first point, although the change is minimal, I did make use of the new option here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, but it's not plumbed through to any non-test logic, afaict

It("should install the CRDs into the cluster", func(done Done) {

crds, err = InstallCRDs(env.Config, CRDInstallOptions{
Paths: []string{filepath.Join(".", "testdata")},
Paths: []string{filepath.Join(".", "testdata")},
ErrorIfPathMissing: env.ErrorIfCRDPathMissing,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, but it's not plumbed through to any non-test logic, afaict

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Dec 16, 2019
@k8s-ci-robot
Copy link
Contributor

@connor1989: PR needs rebase.

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.

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

envtest.Environment.Start() silently fails for missing CRD paths
5 participants