From bbf286cbad9843be3befb2d34cd48b81a094584a Mon Sep 17 00:00:00 2001 From: Ryotaro Banno Date: Fri, 6 Dec 2024 08:28:18 +0000 Subject: [PATCH] test: wait for cache to refresh after PV creation in testDeleteRestoringPV Signed-off-by: Ryotaro Banno --- internal/controller/mantlerestore_controller_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/controller/mantlerestore_controller_test.go b/internal/controller/mantlerestore_controller_test.go index 5614d8c..4bb86ab 100644 --- a/internal/controller/mantlerestore_controller_test.go +++ b/internal/controller/mantlerestore_controller_test.go @@ -370,6 +370,12 @@ func (test *mantleRestoreControllerUnitTest) testDeleteRestoringPV() { err := test.reconciler.createOrUpdateRestoringPV(ctx, restore, test.backup) Expect(err).NotTo(HaveOccurred()) + // Make sure the client cache stores the restoring PV. + Eventually(func(g Gomega) { + err = k8sClient.Get(ctx, client.ObjectKey{Name: test.reconciler.restoringPVName(restore)}, &pv) + g.Expect(err).NotTo(HaveOccurred()) + }).Should(Succeed()) + err = test.reconciler.deleteRestoringPV(ctx, restoreDifferent) Expect(err).To(HaveOccurred())