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

🐛 Fix for TestServerSideApplyWithDefaulting #10307

Conversation

adilGhaffarDev
Copy link
Contributor

@adilGhaffarDev adilGhaffarDev commented Mar 25, 2024

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
possibly Fixes #10305

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-area PR is missing an area label labels Mar 25, 2024
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 25, 2024
@adilGhaffarDev
Copy link
Contributor Author

/area ci

@adilGhaffarDev adilGhaffarDev changed the title [wip]🐛 Fix for TestServerSideApplyWithDefaulting 🐛 Fix for TestServerSideApplyWithDefaulting Mar 25, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 25, 2024
@adilGhaffarDev
Copy link
Contributor Author

/test pull-cluster-api-test-main
/test pull-cluster-api-test-mink8s-main

2 similar comments
@adilGhaffarDev
Copy link
Contributor Author

/test pull-cluster-api-test-main
/test pull-cluster-api-test-mink8s-main

@adilGhaffarDev
Copy link
Contributor Author

/test pull-cluster-api-test-main
/test pull-cluster-api-test-mink8s-main

@adilGhaffarDev
Copy link
Contributor Author

@fabriziopandini @chrischdi if this looks ok, can we merge this before today's release? I have run tests multiple times on this PR, I haven't seen any failure yet.

@@ -653,7 +653,7 @@ func TestServerSideApplyWithDefaulting(t *testing.T) {

// Enable the new defaulting logic (i.e. simulate the Cluster API update).
// The webhook will default the users field to `[{Name: "default-user"}]`.
g.Expect(env.Create(ctx, mutatingWebhookConfiguration)).To(Succeed())
g.Expect(env.CreateAndWait(ctx, mutatingWebhookConfiguration)).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.

Sorry but this doesn't make sense.

The test is failing in l.683 because the KubeadmConfigTemplate doesn't exist in the local cache. Here we are waiting for MutatingWebhookConfiguration.

It probably fixes the issue by accident but I would prefer waiting for the right object (which is kct)

Copy link
Member

Choose a reason for hiding this comment

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

Let's add the following instead in l.652

			// Let's wait until the initial KubeadmConfigTemplate is visible in the local cache. Otherwise the test fails below.
			g.Eventually(ctx, func(g Gomega) {
				g.Expect(env.Get(ctx, client.ObjectKeyFromObject(kct), &bootstrapv1.KubeadmConfigTemplate{})).To(Succeed())
			}, 5*time.Second).Should(Succeed())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added the wait for kct too.

Copy link
Member

Choose a reason for hiding this comment

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

Let's get rid of the CreateAndWait in l.661. We absolutely don't depend on mutatingWebhookConfiguration showing up in the local client cache

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@adilGhaffarDev adilGhaffarDev force-pushed the TestServerSideApplyWithDefaulting-fix/adil branch from c16f2e2 to 885c5a5 Compare March 26, 2024 13:30
Signed-off-by: muhammad adil ghaffar <[email protected]>
@adilGhaffarDev adilGhaffarDev force-pushed the TestServerSideApplyWithDefaulting-fix/adil branch from 885c5a5 to 6cb0a98 Compare March 26, 2024 14:02
@adilGhaffarDev
Copy link
Contributor Author

/test pull-cluster-api-test-main
/test pull-cluster-api-test-mink8s-main

@fabriziopandini fabriziopandini added the area/clusterclass Issues or PRs related to clusterclass label Mar 26, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/needs-area PR is missing an area label label Mar 26, 2024
@fabriziopandini
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 Mar 26, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: ac4382cac51f502e9d58d7f283e25ef7f904008c

@sbueringer
Copy link
Member

sbueringer commented Mar 26, 2024

/approve

Thx!

Feel free to cherry-pick if needed

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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 Mar 26, 2024
@k8s-ci-robot k8s-ci-robot merged commit 284a92f into kubernetes-sigs:main Mar 26, 2024
22 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.7 milestone Mar 26, 2024
@adilGhaffarDev
Copy link
Contributor Author

/cherry-pick release-1.6

@k8s-infra-cherrypick-robot

@adilGhaffarDev: new pull request created: #10327

In response to this:

/cherry-pick release-1.6

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.

@adilGhaffarDev
Copy link
Contributor Author

/cherry-pick release-1.5

@adilGhaffarDev
Copy link
Contributor Author

/cherry-pick release-1.4

@k8s-infra-cherrypick-robot

@adilGhaffarDev: new pull request created: #10344

In response to this:

/cherry-pick release-1.5

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.

@k8s-infra-cherrypick-robot

@adilGhaffarDev: new pull request created: #10345

In response to this:

/cherry-pick release-1.4

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.

@adilGhaffarDev
Copy link
Contributor Author

same failure is happening in release 1-5: https://prow.k8s.io/view/gs/kubernetes-jenkins/logs/periodic-cluster-api-test-release-1-5/1773266012418871296

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. area/clusterclass Issues or PRs related to clusterclass 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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
5 participants