From 7146c9ad890ca88c23576e66eb5ae16fcb59fa24 Mon Sep 17 00:00:00 2001 From: Tyler Gillson Date: Thu, 16 Nov 2023 11:50:36 -0700 Subject: [PATCH] test: fix flaky ValidatorConfig test Signed-off-by: Tyler Gillson --- .../validatorconfig_controller_test.go | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/internal/controller/validatorconfig_controller_test.go b/internal/controller/validatorconfig_controller_test.go index 606bd9c0..8cdbac49 100644 --- a/internal/controller/validatorconfig_controller_test.go +++ b/internal/controller/validatorconfig_controller_test.go @@ -73,14 +73,19 @@ var _ = Describe("ValidatorConfig controller", Ordered, func() { By("Updating the ValidatorConfig") ctx := context.Background() - Expect(k8sClient.Get(ctx, vcKey, vc)).Should(Succeed()) - - vc.Spec.Plugins[0].Chart.Version = networkPluginVersionPost - vc.Spec.Plugins[0].Values = strings.ReplaceAll( - vc.Spec.Plugins[0].Values, networkPluginVersionPre, networkPluginVersionPost, - ) - - Expect(k8sClient.Update(ctx, vc)).Should(Succeed()) + Eventually(func() bool { + if err := k8sClient.Get(ctx, vcKey, vc); err != nil { + return false + } + vc.Spec.Plugins[0].Chart.Version = networkPluginVersionPost + vc.Spec.Plugins[0].Values = strings.ReplaceAll( + vc.Spec.Plugins[0].Values, networkPluginVersionPre, networkPluginVersionPost, + ) + if err := k8sClient.Update(ctx, vc); err != nil { + return false + } + return true + }, timeout, interval).Should(BeTrue(), "failed to update validator-plugin-network") // Wait for the validator-plugin-network Deployment to be upgraded Eventually(func() bool {