Skip to content

Commit cfcf6b3

Browse files
committed
Use DeferCleanup in Node Certificate Controller test
1 parent d308c1d commit cfcf6b3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

internal/controller/node_certificate_controller_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ var _ = Describe("Node Certificate Controller", func() {
7070
},
7171
}
7272
Expect(fakeClient.Create(ctx, resource)).To(Succeed())
73-
})
7473

75-
AfterEach(func(ctx SpecContext) {
76-
node := &corev1.Node{ObjectMeta: metav1.ObjectMeta{Name: nodeName}}
77-
By("Cleanup the specific node")
78-
Expect(client.IgnoreAlreadyExists(fakeClient.Delete(ctx, node))).To(Succeed())
74+
DeferCleanup(func(ctx SpecContext) {
75+
node := &corev1.Node{ObjectMeta: metav1.ObjectMeta{Name: nodeName}}
76+
By("Cleanup the specific node")
77+
Expect(client.IgnoreAlreadyExists(fakeClient.Delete(ctx, node))).To(Succeed())
7978

80-
By("Cleaning up the test environment")
79+
By("Cleaning up the test environment")
80+
})
8181
})
8282

8383
// Tests

0 commit comments

Comments
 (0)