Skip to content

Commit

Permalink
use Eventually to check PVC is not found in testDeleteRestoringPVC
Browse files Browse the repository at this point in the history
Signed-off-by: Ryotaro Banno <ryotaro.banno@gmail.com>
  • Loading branch information
ushitora-anqou committed Dec 3, 2024
1 parent 0e880fc commit 132a4d0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/controller/mantlerestore_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,11 @@ func (test *mantleRestoreControllerUnitTest) testDeleteRestoringPVC() {
err = k8sClient.Update(ctx, &pvc)
Expect(err).NotTo(HaveOccurred())

err = k8sClient.Get(ctx, client.ObjectKey{Name: restore.Name, Namespace: test.tenantNamespace}, &pvc)
Expect(err).To(HaveOccurred())
Expect(errors.IsNotFound(err)).To(BeTrue())
Eventually(ctx, func(g Gomega) {
err = k8sClient.Get(ctx, client.ObjectKey{Name: restore.Name, Namespace: test.tenantNamespace}, &pvc)
g.Expect(err).To(HaveOccurred())
g.Expect(errors.IsNotFound(err)).To(BeTrue())
}).Should(Succeed())
})

It("should skip deleting the PVC if it does not exist", func(ctx SpecContext) {
Expand Down

0 comments on commit 132a4d0

Please sign in to comment.