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
tests: Removes node created by test #78862
Conversation
test/e2e/auth/node_authz.go
Outdated
@@ -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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the test fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
941f8b8
to
91e2abd
Compare
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
91e2abd
to
61582e7
Compare
/test pull-kubernetes-node-e2e-containerd |
/test pull-kubernetes-node-e2e-containerd |
1 similar comment
/test pull-kubernetes-node-e2e-containerd |
8330cc5
to
94e9cdd
Compare
/retest |
/test pull-kubernetes-e2e-gce |
2 similar comments
/test pull-kubernetes-e2e-gce |
/test pull-kubernetes-e2e-gce |
94e9cdd
to
abdeaa3
Compare
/remove-lifecycle stale |
/retest |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle rotten |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc @oomichi
test/e2e/auth/node_authz.go
Outdated
@@ -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{}) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
test/e2e/auth/node_authz.go
Outdated
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
d22bc22
to
51a6031
Compare
51a6031
to
ee9be7c
Compare
Thanks for updating. /test pull-kubernetes-e2e-gce-ubuntu-containerd |
[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 |
/test pull-kubernetes-e2e-gce-ubuntu-containerd |
1 similar comment
/test pull-kubernetes-e2e-gce-ubuntu-containerd |
/lgtm |
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 becomeReady
).Which issue(s) this PR fixes:
Fixes #78861
Special notes for your reviewer:
Does this PR introduce a user-facing change?: