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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃尡 Use internal/builders in tests for webhook package #5622

Conversation

killianmuldoon
Copy link
Contributor

Signed-off-by: killianmuldoon kmuldoon@vmware.com

This updates the unit tests in the webhooks folder to use our test builders instead of raw structs. This will make it easier to create new tests for compatibility and variables in the webhooks package.

Fixes #5621

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 9, 2021
@@ -252,7 +252,7 @@ func (webhook *Cluster) validateTopology(ctx context.Context, old, new *clusterv
allErrs = append(
allErrs, field.Invalid(
field.NewPath("spec", "topology", "class"),
new.Name,
new.Spec.Topology.Class,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a small bugfix to use the clusterClass name in this error message.

Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

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

Great to see builders plugging in in new places 馃コ
one one small nit from my side

webhooks/cluster_test.go Show resolved Hide resolved
Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Overall looks great! A few nits

internal/builder/builders.go Outdated Show resolved Hide resolved
webhooks/cluster_test.go Show resolved Hide resolved
webhooks/cluster_test.go Outdated Show resolved Hide resolved
webhooks/clusterclass_test.go Outdated Show resolved Hide resolved
webhooks/clusterclass_test.go Outdated Show resolved Hide resolved
webhooks/clusterclass_test.go Outdated Show resolved Hide resolved
webhooks/clusterclass_test.go Outdated Show resolved Hide resolved
@killianmuldoon killianmuldoon force-pushed the test/add-builders-to-webhook-tests branch 3 times, most recently from ae9e817 to c3234a6 Compare November 10, 2021 11:32
@sbueringer
Copy link
Member

lgtm +/- squash

Signed-off-by: killianmuldoon <kmuldoon@vmware.com>
@killianmuldoon killianmuldoon force-pushed the test/add-builders-to-webhook-tests branch from c3234a6 to 87afe7f Compare November 10, 2021 13:48
@fabriziopandini
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 15, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 15, 2021
@sbueringer
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot merged commit e64e069 into kubernetes-sigs:main Nov 15, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.1 milestone Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add test builders to Cluster and ClusterClass webhooks
5 participants