Skip to content

Commit ac12bab

Browse files
committed
Expected k8sClient.Delete to succeed
1 parent 14ee3f7 commit ac12bab

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

tests/cel/common.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ func validateCrd(t *testing.T, wantErrors []string, crd client.Object, k8sClient
9292
t.Helper()
9393
g := NewWithT(t)
9494

95-
// Create the resource in the cluster
96-
// Use a context with a timeout to avoid hanging tests
97-
var deleteErr error
9895
timeoutConfig := framework.DefaultTimeoutConfig()
9996
ctx, cancel := context.WithTimeout(context.Background(), timeoutConfig.KubernetesClientTimeout)
10097
defer cancel()
@@ -104,10 +101,7 @@ func validateCrd(t *testing.T, wantErrors []string, crd client.Object, k8sClient
104101
if len(wantErrors) == 0 {
105102
g.Expect(err).ToNot(HaveOccurred())
106103
// Clean up after test
107-
defer func() {
108-
deleteErr = k8sClient.Delete(ctx, crd)
109-
g.Expect(deleteErr).ToNot(HaveOccurred())
110-
}()
104+
g.Expect(k8sClient.Delete(ctx, crd)).To(Succeed())
111105
} else {
112106
g.Expect(err).To(HaveOccurred())
113107
for _, wantError := range wantErrors {

0 commit comments

Comments
 (0)