Skip to content

Commit

Permalink
Avoid data pollution on tear-down
Browse files Browse the repository at this point in the history
We are deleting the test org in background. By deleting a copy of the
org we ensure that the shared `testOrg` variable is not modified once
deletion is done. Not doing that would mess up subsequent `It`s

Co-authored-by: Georgi Sabev <georgethebeatle@gmail.com>
  • Loading branch information
danail-branekov and georgethebeatle committed Apr 23, 2024
1 parent 46197a8 commit f60426c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/crds/crds_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ var _ = BeforeEach(func() {
})

var _ = AfterEach(func() {
Expect(k8sClient.Delete(ctx, testOrg, &client.DeleteOptions{
Expect(k8sClient.Delete(ctx, testOrg.DeepCopy(), &client.DeleteOptions{
PropagationPolicy: tools.PtrTo(metav1.DeletePropagationBackground),
})).To(Succeed())
})

0 comments on commit f60426c

Please sign in to comment.