From ee9be7ce5a17522c30e3799ca61f3b6e5da434d5 Mon Sep 17 00:00:00 2001 From: Claudiu Belu Date: Sat, 8 Jun 2019 21:33:23 -0700 Subject: [PATCH] tests: Removes node created by test 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. --- test/e2e/auth/node_authz.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/e2e/auth/node_authz.go b/test/e2e/auth/node_authz.go index f235c0cf724..77b472adaa3 100644 --- a/test/e2e/auth/node_authz.go +++ b/test/e2e/auth/node_authz.go @@ -174,6 +174,13 @@ 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{}) + + // NOTE: If the test fails and a new node IS created, we need to delete it. If we don't, we'd have + // a zombie node in a NotReady state which will delay further tests since we're waiting for all + // tests to be in the Ready state. + defer func() { + f.ClientSet.CoreV1().Nodes().Delete(context.TODO(), node.Name, metav1.DeleteOptions{}) + }() framework.ExpectEqual(apierrors.IsForbidden(err), true) })