Skip to content

Commit 5d0731f

Browse files
UPSTREAM: <carry>: move defercleanup for sa for LIFO
1 parent e596858 commit 5d0731f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

openshift/tests-extension/test/olmv1-catalog.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ func verifyCatalogEndpoint(ctx SpecContext, catalog, endpoint, query string) {
9090
serviceAccount.SetNamespace("default")
9191

9292
err = k8sClient.Create(ctx, serviceAccount)
93+
Expect(err).NotTo(HaveOccurred(), "failed to create Service Account")
94+
95+
DeferCleanup(func(ctx SpecContext) {
96+
_ = k8sClient.Delete(ctx, serviceAccount)
97+
})
9398

9499
if err != nil && !apierrors.IsAlreadyExists(err) {
95100
Fail(fmt.Sprintf("Failed to ensure ServiceAccount %s: %v", jobNamePrefix, err))
@@ -101,7 +106,6 @@ func verifyCatalogEndpoint(ctx SpecContext, catalog, endpoint, query string) {
101106

102107
DeferCleanup(func(ctx SpecContext) {
103108
_ = k8sClient.Delete(ctx, job)
104-
// _ = k8sClient.Delete(ctx, serviceAccount)
105109
})
106110

107111
By("Waiting for Job to succeed")

0 commit comments

Comments
 (0)