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

tests: Removes node created by test #78862

Merged
merged 1 commit into from Jan 21, 2021

Conversation

claudiubelu
Copy link
Contributor

What type of PR is this?

/kind bug
/kind cleanup

What this PR does / why we need it:

The test "A node shouldn't be able to create another node" could create
a node during its run, but it doesn't delete it in this case.

This PR addresses this issue.

This will also reduce the run time of the test from 200 seconds to 20 (the extra time was spent waiting for the undeleted foo node to become Ready).

Which issue(s) this PR fixes:

Fixes #78861

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jun 10, 2019
@@ -175,6 +175,12 @@ var _ = SIGDescribe("[Feature:NodeAuthorizer]", func() {
}
ginkgo.By(fmt.Sprintf("Create node foo by user: %v", asUser))
_, err := c.CoreV1().Nodes().Create(node)
Copy link
Member

Choose a reason for hiding this comment

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

This create is not expected to succeed. In the case where there's not a bug in node authorization, there's no node to delete.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's what it is expected to happen. But it managed to create a node for me, and having it exist prolongs the execution time of every test in the test suite by a lot.

Copy link
Member

Choose a reason for hiding this comment

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

Does the test fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep.

Copy link
Member

Choose a reason for hiding this comment

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

Why don't you make the test pass or skip the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would solve the issue for me, but other people might still hit this issue. It is always a good idea to cleanup test created resources, even if the test verifies that it can't create the resources, but it did.

I see no reason no to go forth with this, the failure will still be a failure, but at least there won't be a zombie node laying around.

@mikedanese mikedanese added the sig/auth Categorizes an issue or PR as relevant to SIG Auth. label Jun 11, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 8, 2019
@claudiubelu
Copy link
Contributor Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 8, 2019
@claudiubelu
Copy link
Contributor Author

/test pull-kubernetes-node-e2e-containerd
/test pull-kubernetes-e2e-kind

@claudiubelu
Copy link
Contributor Author

/test pull-kubernetes-node-e2e-containerd

1 similar comment
@claudiubelu
Copy link
Contributor Author

/test pull-kubernetes-node-e2e-containerd

@claudiubelu claudiubelu force-pushed the tests/cleanup-node branch 2 times, most recently from 8330cc5 to 94e9cdd Compare February 10, 2020 17:43
@claudiubelu
Copy link
Contributor Author

/retest

@claudiubelu
Copy link
Contributor Author

/test pull-kubernetes-e2e-gce

2 similar comments
@claudiubelu
Copy link
Contributor Author

/test pull-kubernetes-e2e-gce

@claudiubelu
Copy link
Contributor Author

/test pull-kubernetes-e2e-gce

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 12, 2020
@claudiubelu
Copy link
Contributor Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 14, 2020
@claudiubelu
Copy link
Contributor Author

/retest

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 1, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Dec 1, 2020
@claudiubelu
Copy link
Contributor Author

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Dec 2, 2020
Copy link
Member

@oomichi oomichi left a comment

Choose a reason for hiding this comment

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

/cc @oomichi

@@ -174,6 +174,12 @@ var _ = SIGDescribe("[Feature:NodeAuthorizer]", func() {
}
ginkgo.By(fmt.Sprintf("Create node foo by user: %v", asUser))
_, err := c.CoreV1().Nodes().Create(context.TODO(), node, metav1.CreateOptions{})
defer func() {
err := f.ClientSet.CoreV1().Nodes().Delete(context.TODO(), node.Name, metav1.DeleteOptions{})
Copy link
Member

Choose a reason for hiding this comment

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

It is better to write NOTE why we need this cleanup, because in the expected test path the node creation is failed and we don't need to do cleanup here.

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, wrote a comment explaining it.

defer func() {
err := f.ClientSet.CoreV1().Nodes().Delete(context.TODO(), node.Name, metav1.DeleteOptions{})
if err != nil {
framework.Logf("Failed to get delete node %v, err: %v", node, err)
Copy link
Member

Choose a reason for hiding this comment

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

In the expected test path, this Delete() call is always failed.
I don't think it is worth to put any log which contains Failed ... even but the log level is not Error.

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

The test "A node shouldn't be able to create another node" could create
a node during its run, but it doesn't delete it in this case.

This commit addresses this issue.
@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 Jan 15, 2021
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 15, 2021
@oomichi
Copy link
Member

oomichi commented Jan 19, 2021

Thanks for updating.

/test pull-kubernetes-e2e-gce-ubuntu-containerd
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: claudiubelu, oomichi

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 Jan 19, 2021
@claudiubelu
Copy link
Contributor Author

/test pull-kubernetes-e2e-gce-ubuntu-containerd

1 similar comment
@claudiubelu
Copy link
Contributor Author

/test pull-kubernetes-e2e-gce-ubuntu-containerd

@adelina-t
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 21, 2021
@k8s-ci-robot k8s-ci-robot merged commit e1ba754 into kubernetes:master Jan 21, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Jan 21, 2021
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/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. 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. sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/testing Categorizes an issue or PR as relevant to SIG Testing. 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.

tests: Test creates new node, but does not delete it afterwards
6 participants