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

🌱 add basic integration tests for ClusterClass webhook #5803

Merged

Conversation

killianmuldoon
Copy link
Contributor

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

This PR adds basic integration tests for the ClusterClass webhook assessing whether Create, Delete and Update validations work as expected with a real API server.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 6, 2021
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 6, 2021

CLA Signed

The committers are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 6, 2021
@killianmuldoon
Copy link
Contributor Author

Question: In order to add the index check to the ClusterClass webhooks client.Get (clusters) #5719 We'd need to port many complex table tests to use envtest in this package. Is that the direction I should go?

/cc @fabriziopandini @sbueringer

@sbueringer
Copy link
Member

Question: In order to add the index check to the ClusterClass webhooks client.Get (clusters) #5719 We'd need to port many complex table tests to use envtest in this package. Is that the direction I should go?

/cc @fabriziopandini @sbueringer

I'm not sure I get the full context. But I would assume it's good enough to cover the case where we also have another cluster which is not using the same ClusterClass. I think everything else doesn't have to duplicated.

@killianmuldoon
Copy link
Contributor Author

@sbueringer I think there's three cases that currently require testenv and I'll probably add in a couple more. The plan is to add the indexer and the testenv dependent test cases to this directory (In another PR) - does that sound right to you?

@sbueringer
Copy link
Member

@sbueringer I think there's three cases that currently require testenv and I'll probably add in a couple more. The plan is to add the indexer and the testenv dependent test cases to this directory (In another PR) - does that sound right to you?

Sounds good to me.

@killianmuldoon
Copy link
Contributor Author

/check-cla

internal/webhooks/test/suite_test.go Outdated Show resolved Hide resolved
internal/webhooks/test/suite_test.go Show resolved Hide resolved
internal/webhooks/test/suite_test.go Outdated Show resolved Hide resolved
internal/webhooks/test/clusterclass_test.go Outdated Show resolved Hide resolved
internal/webhooks/test/clusterclass_test.go Outdated Show resolved Hide resolved
internal/webhooks/test/clusterclass_test.go Outdated Show resolved Hide resolved
@sbueringer
Copy link
Member

Thx! lgtm pending squash

@sbueringer
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 7, 2021
Build()

// Create the ClusterClass in the API server.
g.Expect(env.Create(ctx, clusterClass)).To(Succeed())
Copy link
Member

Choose a reason for hiding this comment

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

Should this be

Suggested change
g.Expect(env.Create(ctx, clusterClass)).To(Succeed())
g.Expect(env.CreateAndWait(ctx, clusterClass)).To(Succeed())

so we reduce the chance of flakiness (same below when we have objects depending on each others)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea - I've also changed the Deletes to Cleanups / CleanupAndWait where appropriate.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 9, 2021
Signed-off-by: killianmuldoon <kmuldoon@vmware.com>
@fabriziopandini
Copy link
Member

yay! more tests!
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 9, 2021
@sbueringer
Copy link
Member

Thx!
/lgtm

@fabriziopandini
Copy link
Member

/approve

@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 Dec 9, 2021
@k8s-ci-robot k8s-ci-robot merged commit 2e24f6f into kubernetes-sigs:main Dec 9, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.1 milestone Dec 9, 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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants