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

🐛 ssa: fix flaky test TestPatch/Test patch with Machine #9914

Merged
merged 1 commit into from
Dec 22, 2023

Conversation

chrischdi
Copy link
Member

During the test at the additional Patch calls the defaulting webhook did always set the .spec.infrastructureRef.namespace field.

This caused flaky behaviour because there was a chance for the resourceVersion to getting bumped with the only change being the timestamp in managedFields.

What this PR does / why we need it:

This flake was reproducible by either the following command:

go test -race -count 120 -failfast -shuffle on -timeout 30s -run '^TestPatch$' sigs.k8s.io/cluster-api/internal/util/ssa

Or by adding a time.Sleep(time.Second) at:

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 #8478

Area example:
/area testing

@k8s-ci-robot k8s-ci-robot added area/testing Issues or PRs related to testing cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 22, 2023
@chrischdi chrischdi changed the title ssa: fix flaky test TestPatch/Test patch with Machine 🐛 ssa: fix flaky test TestPatch/Test patch with Machine Dec 22, 2023
@chrischdi
Copy link
Member Author

/cherry-pick release-1.6

@k8s-infra-cherrypick-robot

@chrischdi: once the present PR merges, I will cherry-pick it on top of release-1.6 in a new PR and assign it to you.

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.

@chrischdi
Copy link
Member Author

/cherry-pick release-1.5

@k8s-infra-cherrypick-robot

@chrischdi: once the present PR merges, I will cherry-pick it on top of release-1.5 in a new PR and assign it to you.

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.

During the test at the additional Patch calls the defaulting webhook did always
set the .spec.infrastructureRef.namespace field.

This caused flaky behaviour because there was a chance for the resourceVersion
to getting bumped with the only change being the timestamp in managedFields.
@chrischdi
Copy link
Member Author

Note: this flake also exists on the still getting tested release-1.4 branch. Should we also cherry-pick to release-1.4 while this branch is already out of support?

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.

Nice catch!
/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 Dec 22, 2023
@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
Copy link
Contributor

LGTM label has been added.

Git tree hash: efb1f2e8b1e0b511cd92e424e5374b19f55e2e45

@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 22, 2023
@k8s-ci-robot k8s-ci-robot merged commit 7a1830a into kubernetes-sigs:main Dec 22, 2023
20 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.7 milestone Dec 22, 2023
@k8s-infra-cherrypick-robot

@chrischdi: new pull request created: #9915

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.

@k8s-infra-cherrypick-robot

@chrischdi: new pull request created: #9916

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.

@chrischdi
Copy link
Member Author

/cherry-pick release-1.4

@k8s-infra-cherrypick-robot

@chrischdi: new pull request created: #9917

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.

@sbueringer
Copy link
Member

sbueringer commented Jan 2, 2024

@chrischdi Nice catch! So the test failed when we hit the case where the timestamp was >1s higher than initially? Otherwise there was no diff?

Thinking about the practical implications. Does this mean we are continuously updating objects as soon as a single field is not set by us (the client) and defaulted by a webhook instead? (i.e. the cache doesn't work in this case)

@chrischdi
Copy link
Member Author

@chrischdi Nice catch! So the test failed when we hit the case where the timestamp was >1s higher than initially? Otherwise there was no diff?

Thinking about the practical implications. Does this mean we are continuously updating objects as soon as a single field is not set by us (the client) and defaulted by a webhook instead? (i.e. the cache doesn't work in this case)

Yes that was the case in the test. Don't know if this also gets hit in a real scenario 🤔 maybe worth to try it

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/testing Issues or PRs related to testing 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
Development

Successfully merging this pull request may close these issues.

TestPatch is flaky
5 participants