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

Support e2e integration tests w all webhooks & controller #326

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

akutz
Copy link
Collaborator

@akutz akutz commented Dec 27, 2023

What does this PR do, and why is it needed?

This patch introduces the new function NewTestSuiteWithOptions for creating a test suite that supports all webhooks, both conversion and admission, as well as controllers. This enables end-to-end testing of a controller via integration tests where the production webhooks are installed and part of the reconciliation.

Which issue(s) is/are addressed by this PR? (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):

Fixes NA

Are there any special notes for your reviewer:

I am not going to implement the new test suite for all controllers in this one PR. I've implemented for the VirtualMachine controllers (v1a1 and v1a2) as an example, and follow-up PRs can implement the new suite for the other controllers.

Please add a release note if necessary:

Use NewTestSuiteWithOptions for enhanced integration test capabilities.

@github-actions github-actions bot added the size/XL Denotes a PR that changes 500-999 lines. label Dec 27, 2023
@akutz akutz force-pushed the feature/e2e-integration-test branch from 9dc0f63 to 8ed73e6 Compare December 27, 2023 20:48
@akutz akutz changed the title ✨ WiP: Support e2e integration tests w all webhooks & controller Support e2e integration tests w all webhooks & controller Dec 27, 2023
@akutz akutz force-pushed the feature/e2e-integration-test branch 2 times, most recently from 4795034 to cd8c2c9 Compare December 27, 2023 21:17
@akutz akutz requested a review from bryanv December 27, 2023 21:20
This patch introduces the new function "NewTestSuiteWithOptions" for
creating a test suite that supports all webhooks, both conversion and
admission, as well as controllers. This enables end-to-end testing of
a controller via integration tests where the production webhooks are
installed and part of the reconciliation.
@akutz akutz force-pushed the feature/e2e-integration-test branch from cd8c2c9 to 6448032 Compare December 28, 2023 15:25
Copy link

Code Coverage

Package Line Rate Health
github.com/vmware-tanzu/vm-operator/api/utilconversion 91%
github.com/vmware-tanzu/vm-operator/api/v1alpha1 37%
github.com/vmware-tanzu/vm-operator/api/v1alpha2 28%
github.com/vmware-tanzu/vm-operator/api/v1alpha2/cloudinit 25%
github.com/vmware-tanzu/vm-operator/api/v1alpha2/common 15%
github.com/vmware-tanzu/vm-operator/api/v1alpha2/sysprep 29%
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/v1alpha1/clustercontentlibraryitem 83%
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/v1alpha1/contentlibraryitem 82%
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/v1alpha1/contentsource 83%
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/v1alpha1/utils 95%
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/v1alpha2/clustercontentlibraryitem 86%
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/v1alpha2/contentlibraryitem 85%
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/v1alpha2/utils 91%
github.com/vmware-tanzu/vm-operator/controllers/infracluster 75%
github.com/vmware-tanzu/vm-operator/controllers/infraprovider 75%
github.com/vmware-tanzu/vm-operator/controllers/providerconfigmap 75%
github.com/vmware-tanzu/vm-operator/controllers/util/encoding 73%
github.com/vmware-tanzu/vm-operator/controllers/util/remote 41%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachine/v1alpha1 45%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachine/v1alpha2 70%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineclass/v1alpha1 31%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineclass/v1alpha2 22%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinepublishrequest/v1alpha1 83%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinepublishrequest/v1alpha2 81%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineservice/v1alpha1 82%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineservice/v1alpha1/providers 96%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineservice/v1alpha1/providers/simplelb 66%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineservice/v1alpha1/utils 84%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineservice/v1alpha2 84%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineservice/v1alpha2/providers 96%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineservice/v1alpha2/providers/simplelb 66%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineservice/v1alpha2/utils 83%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinesetresourcepolicy/v1alpha1 80%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinesetresourcepolicy/v1alpha2 80%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinewebconsolerequest/v1alpha1 74%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinewebconsolerequest/v1alpha2 72%
github.com/vmware-tanzu/vm-operator/controllers/volume/v1alpha1 86%
github.com/vmware-tanzu/vm-operator/controllers/volume/v1alpha2 87%
github.com/vmware-tanzu/vm-operator/pkg/builder 76%
github.com/vmware-tanzu/vm-operator/pkg/conditions 90%
github.com/vmware-tanzu/vm-operator/pkg/conditions2 92%
github.com/vmware-tanzu/vm-operator/pkg/context 0%
github.com/vmware-tanzu/vm-operator/pkg/context/fake 100%
github.com/vmware-tanzu/vm-operator/pkg/lib 85%
github.com/vmware-tanzu/vm-operator/pkg/manager 79%
github.com/vmware-tanzu/vm-operator/pkg/metrics 89%
github.com/vmware-tanzu/vm-operator/pkg/metrics2 85%
github.com/vmware-tanzu/vm-operator/pkg/patch 79%
github.com/vmware-tanzu/vm-operator/pkg/patch2 78%
github.com/vmware-tanzu/vm-operator/pkg/prober 92%
github.com/vmware-tanzu/vm-operator/pkg/prober/context 100%
github.com/vmware-tanzu/vm-operator/pkg/prober/fake 85%
github.com/vmware-tanzu/vm-operator/pkg/prober/fake/probe 83%
github.com/vmware-tanzu/vm-operator/pkg/prober/fake/worker 88%
github.com/vmware-tanzu/vm-operator/pkg/prober/probe 83%
github.com/vmware-tanzu/vm-operator/pkg/prober/worker 86%
github.com/vmware-tanzu/vm-operator/pkg/prober2 91%
github.com/vmware-tanzu/vm-operator/pkg/prober2/context 100%
github.com/vmware-tanzu/vm-operator/pkg/prober2/fake 85%
github.com/vmware-tanzu/vm-operator/pkg/prober2/fake/probe 83%
github.com/vmware-tanzu/vm-operator/pkg/prober2/fake/worker 89%
github.com/vmware-tanzu/vm-operator/pkg/prober2/probe 92%
github.com/vmware-tanzu/vm-operator/pkg/prober2/worker 80%
github.com/vmware-tanzu/vm-operator/pkg/record 89%
github.com/vmware-tanzu/vm-operator/pkg/topology 85%
github.com/vmware-tanzu/vm-operator/pkg/util 86%
github.com/vmware-tanzu/vm-operator/pkg/util/cloudinit 89%
github.com/vmware-tanzu/vm-operator/pkg/util/cloudinit/schema 25%
github.com/vmware-tanzu/vm-operator/pkg/util/cloudinit/validate 93%
github.com/vmware-tanzu/vm-operator/pkg/util/kube 89%
github.com/vmware-tanzu/vm-operator/pkg/util/vsphere/vm 74%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/fake 74%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere 71%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere/client 49%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere/clustermodules 85%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere/config 85%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere/contentlibrary 71%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere/credentials 100%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere/instancestorage 92%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere/internal 0%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere/network 88%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere/placement 83%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere/resources 47%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere/session 84%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere/storage 77%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere/test 98%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere/vcenter 80%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere/virtualmachine 83%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2 70%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/client 49%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/clustermodules 85%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/config 70%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/contentlibrary 72%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/credentials 100%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/instancestorage 92%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/internal 0%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/network 85%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/placement 70%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/resources 38%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/session 83%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/storage 77%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/sysprep 100%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/test 98%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/vcenter 80%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/virtualmachine 83%
github.com/vmware-tanzu/vm-operator/pkg/vmprovider/providers/vsphere2/vmlifecycle 79%
github.com/vmware-tanzu/vm-operator/pkg/webconsolevalidation 53%
github.com/vmware-tanzu/vm-operator/webhooks/common 100%
github.com/vmware-tanzu/vm-operator/webhooks/persistentvolumeclaim/validation 95%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachine/v1alpha1/mutation 82%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachine/v1alpha1/validation 95%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachine/v1alpha2/mutation 82%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachine/v1alpha2/validation 95%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineclass/v1alpha1/mutation 46%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineclass/v1alpha1/validation 89%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineclass/v1alpha2/mutation 47%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineclass/v1alpha2/validation 89%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinepublishrequest/v1alpha1/validation 92%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinepublishrequest/v1alpha2/validation 92%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineservice/v1alpha1/mutation 42%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineservice/v1alpha1/validation 91%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineservice/v1alpha2/mutation 43%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineservice/v1alpha2/validation 91%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinesetresourcepolicy/v1alpha1/mutation 42%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinesetresourcepolicy/v1alpha1/validation 89%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinesetresourcepolicy/v1alpha2/validation 89%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinewebconsolerequest/v1alpha1/validation 92%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinewebconsolerequest/v1alpha2/validation 92%
Summary 70% (13530 / 19450)

Minimum allowed line rate is 60%

},
MutationWebhooks: []builder.TestSuiteMutationWebhookOptions{
{
Name: "default.mutating.virtualmachine.v1alpha1.vmoperator.vmware.com",
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're trying to mimic the actual env, the v1a1 webhooks aren't enabled in v1a2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-not-required size/XL Denotes a PR that changes 500-999 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants