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 TestReconcileMachinePoolScaleToFromZero flakes #9745

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

loktev-d
Copy link
Contributor

What this PR does / why we need it:
I've managed to reproduce the flakes on my local machine, it seems that the test flakes due to some random cache sync delays when creating a node with envtest, CAPI Testing documentation recommends using CreateAndWait for such cases.

Which issue(s) this PR fixes:
Fixes #8993

/area machinepool

@k8s-ci-robot k8s-ci-robot added area/machinepool Issues or PRs related to machinepools cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 21, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @loktev-d!

It looks like this is your first PR to kubernetes-sigs/cluster-api 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 21, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @loktev-d. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Nov 21, 2023
@enxebre
Copy link
Member

enxebre commented Nov 22, 2023

/ok-to-test
/lgtm

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 22, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 22, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: f639ae756554f420b207318eceddd5ff090ae953

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 28, 2023
@k8s-ci-robot k8s-ci-robot requested a review from enxebre November 28, 2023 16:06
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 28, 2023
@loktev-d
Copy link
Contributor Author

Also removed namespace from cleanup because envtest does not support namespace deletion and the test was failing.

@loktev-d
Copy link
Contributor Author

/retest

@Jont828
Copy link
Contributor

Jont828 commented Dec 1, 2023

/lgtm

I think we want to keep running the flaky test several times once you squash to ensure that we have a consistent green signal.

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

LGTM label has been added.

Git tree hash: 2044bf3dac08871aed71ff16607b60e5973c585f

@sbueringer
Copy link
Member

Also removed namespace from cleanup because envtest does not support namespace deletion and the test was failing.

In general envtest supports deleting Namespaces. Do you know why exactly it fails?

@loktev-d
Copy link
Contributor Author

loktev-d commented Dec 4, 2023

@sbueringer Here is the error https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_cluster-api/9745/pull-cluster-api-test-main/1729532220189708288

Kubebuilder doc (https://book.kubebuilder.io/reference/envtest.html) says

EnvTest does not support namespace deletion. Deleting a namespace will seem to succeed, but the namespace will just be put in a Terminating state, and never actually be reclaimed.

and removing the namespace helped, so I thought it was the cause.

@sbueringer
Copy link
Member

Sorry my bad, I was wrong. I thought it works, because we are doing it in similar tests. But they are probably using the fake client and not envtest. Makes sense that namespaces are getting stuck in Terminating when there is no controller-manager running removing the Kubernetes finalizer.

/lgtm

Can you please squash the commits? I'll merge afterwards

@sbueringer
Copy link
Member

I think we want to keep running the flaky test several times once you squash to ensure that we have a consistent green signal.

I think we're fine. Tests are green and while we don't 100% know if it resolves the flake, the PR is definitely an improvement and we can check in CI after merge if the flake still occurs.

Replace env.Create and env.Cleanup with env.CreateAndWait and
env.CleanupAndWait, remove namespace from cleanup.
@loktev-d
Copy link
Contributor Author

loktev-d commented Dec 6, 2023

@sbueringer Done

@sbueringer
Copy link
Member

Thank you very much!!!

/approve

Let's try to cherry-pick

@sbueringer
Copy link
Member

/cherry-pick release-1.6

@k8s-infra-cherrypick-robot

@sbueringer: 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.

@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

@sbueringer
Copy link
Member

/cherry-pick release-1.5

@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 6, 2023
@k8s-infra-cherrypick-robot

@sbueringer: 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.

@k8s-ci-robot k8s-ci-robot merged commit 226b816 into kubernetes-sigs:main Dec 6, 2023
19 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.7 milestone Dec 6, 2023
@k8s-infra-cherrypick-robot

@sbueringer: new pull request created: #9822

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

@sbueringer: new pull request created: #9823

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.

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/machinepool Issues or PRs related to machinepools 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

TestReconcileMachinePoolScaleToFromZero is flaky
6 participants