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

test: Fix flake in node e2e mirror pod tests #117000

Merged
merged 1 commit into from
Apr 12, 2023

Conversation

bobbypage
Copy link
Member

@bobbypage bobbypage commented Mar 30, 2023

The newly added MirrorPodWithGracePeriod when create a mirror pod and the container runtime is temporarily down during pod termination test is currently flaking because in some cases when it is run there are other pods from other tests that are still in progress of being terminated. This results in the test failing because it asserts metrics that assume that there is only one pod running on the node.

To fix the flake, prior to starting the test, verify that no pods exist in the api server.

What type of PR is this?

/kind flake

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #116998

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Mar 30, 2023
@k8s-ci-robot
Copy link
Contributor

Please note that we're already in Test Freeze for the release-1.27 branch. This means every merged PR will be automatically fast-forwarded via the periodic ci-fast-forward job to the release branch of the upcoming v1.27.0 release.

Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Wed Mar 29 22:31:15 UTC 2023.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Mar 30, 2023
@k8s-ci-robot k8s-ci-robot added sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Mar 30, 2023
@pacoxu
Copy link
Member

pacoxu commented Mar 30, 2023

/kind flake
/priority important-soon
/triage accepted

@k8s-ci-robot k8s-ci-robot added kind/flake Categorizes issue or PR as related to a flaky test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 30, 2023
@pacoxu
Copy link
Member

pacoxu commented Mar 30, 2023

The fix makes sense in my opinion.

However, as this is a Serial e2e test, it is heard that this is caused by the bad cleanup of another test case.

  • If we can know which test case is finished with some pod in terminating mode(not cleaned), adding the check in the AfterEach would be better, right?

Adding this is no harm to other 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 Mar 30, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 5787f5c106720bcb959a4e9fc510ef3c09d10b72

@bart0sh
Copy link
Contributor

bart0sh commented Mar 30, 2023

/assign @mrunalp @derekwaynecarr @dchen1107

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 31, 2023
@bobbypage
Copy link
Member Author

/test pull-kubernetes-cos-cgroupv2-containerd-node-e2e-serial

@bobbypage
Copy link
Member Author

bobbypage commented Mar 31, 2023

If we can know which test case is finished with some pod in terminating mode(not cleaned), adding the check in the AfterEach would be better, right?

The issue is that the tests themselves are not responsible for cleaning up their resources, this is the responsibility of the test framework. The test framework creates a new namespace for every test and when the test finishes, it deletes the namespace. But the namespace is deleted asynchronously, i.e. the test framework doesn't wait until all the resources are deleted until moving on to the next test (this is by design). This is fine for parallel tests, but for serial tests that assume they are the only thing running can sometimes be an issue.

See related slack thread about this here.

It might be worth to consider in future if for node e2e serial tests in particular, we should adapt the test framework to explicitly wait until the namespace is deleted. It may slow down test time, but maybe that is acceptable.

The newly added `MirrorPodWithGracePeriod when create a mirror pod and
the container runtime is temporarily down during pod termination` test
is currently flaking because in some cases when it is run there are
other pods from other tests that are still in progress of being
terminated. This results in the test failing because it asserts metrics
that assume that there is only one pod running on the node.

To fix the flake, prior to starting the test, verify that no pods exist
in the api server other then the newly created mirror pod.

Signed-off-by: David Porter <david@porter.me>
@bobbypage
Copy link
Member Author

/test pull-kubernetes-cos-cgroupv2-containerd-node-e2e-serial

@bart0sh
Copy link
Contributor

bart0sh commented Mar 31, 2023

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

LGTM label has been added.

Git tree hash: 715c7784ade78a57dc4626702d6502a7e1e6accb

Copy link
Member

@pacoxu pacoxu left a comment

Choose a reason for hiding this comment

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

/lgtm

@oomichi
Copy link
Member

oomichi commented Apr 4, 2023

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bobbypage, oomichi, pacoxu

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 Apr 4, 2023
@k8s-ci-robot k8s-ci-robot merged commit 95d3492 into kubernetes:master Apr 12, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.28 milestone Apr 12, 2023
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/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/flake Categorizes issue or PR as related to a flaky test. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Archived in project
8 participants