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 flaky TestServerSideApplyWithDefaulting test #8166

Merged
merged 1 commit into from
Feb 24, 2023

Conversation

sbueringer
Copy link
Member

@sbueringer sbueringer commented Feb 23, 2023

Signed-off-by: Stefan Büringer buringerst@vmware.com

What this PR does / why we need it:
I think this should fix it.

xref: https://prow.k8s.io/view/gs/kubernetes-jenkins/logs/periodic-cluster-api-test-main/1628652755163811840

Also saw the same failure on a few PRs.

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

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 23, 2023
@sbueringer
Copy link
Member Author

/assign @killianmuldoon @fabriziopandini

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 23, 2023
// Ensure patchKCT was defaulted.
g.Expect(env.Get(ctx, client.ObjectKeyFromObject(kct), patchKCT))
g.Expect(patchKCT.Spec.Template.Spec.Users).To(Equal([]bootstrapv1.User{{Name: "default-user"}}))
}, 5*time.Second).Should(Succeed())
Copy link
Contributor

Choose a reason for hiding this comment

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

Q on this, but not really for this PR. Wasn't there an issue recently with incorrectly specified timeouts / polling frequencies with Gomega's eventually?

I can't remember exactly what the issue was though.

Copy link
Member Author

@sbueringer sbueringer Feb 24, 2023

Choose a reason for hiding this comment

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

Nice catch, thank you.

But turns out my previous take was wrong.

gomega is doing the following

	if len(intervals) > 0 {
		timeoutInterval, err = toDuration(intervals[0])
		if err != nil {
			g.Fail(err.Error(), offset+baseOffset)
		}
	}
	if len(intervals) > 1 {
		pollingInterval, err = toDuration(intervals[1])
		if err != nil {
			g.Fail(err.Error(), offset+baseOffset)
		}
	}

Which means if you only set one interval you only set the timeoutInterval and not the pollingInterval.

I thought this means it doesn't actually retry. I justed tested it and it turns out it does retry. Going through some gomega internals reveals that gomega is using a default poll interval of 100ms (100ms for eventually, 10ms for consistently)

So we should be good

Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

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

/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 Feb 24, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 4aa47c606da1eb268bb2aa8223d10ee8c6afbefc

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: killianmuldoon

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 Feb 24, 2023
Signed-off-by: Stefan Büringer buringerst@vmware.com
@k8s-ci-robot k8s-ci-robot merged commit 87b19f5 into kubernetes-sigs:main Feb 24, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.4 milestone Feb 24, 2023
@sbueringer sbueringer deleted the pr-fix-test-flake-ssa branch February 24, 2023 14:05
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/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.

None yet

4 participants