From 06b1e04e6632412303c1fbd383c619ab67765f17 Mon Sep 17 00:00:00 2001 From: 3u13r Date: Thu, 26 Jan 2023 17:52:28 +0100 Subject: [PATCH] operator: make test more resilient (#1073) --- .../controllers/nodeversion_controller_env_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/operators/constellation-node-operator/controllers/nodeversion_controller_env_test.go b/operators/constellation-node-operator/controllers/nodeversion_controller_env_test.go index dc2bc5808..ad419aa6c 100644 --- a/operators/constellation-node-operator/controllers/nodeversion_controller_env_test.go +++ b/operators/constellation-node-operator/controllers/nodeversion_controller_env_test.go @@ -307,8 +307,12 @@ var _ = Describe("NodeVersion controller", func() { } return firstNode.Annotations }, timeout, interval).Should(HaveKeyWithValue(heirAnnotation, secondNodeName)) - Expect(k8sClient.Get(ctx, secondNodeLookupKey, secondNode)).Should(Succeed()) - Expect(secondNode.Annotations).Should(HaveKeyWithValue(donorAnnotation, firstNodeName)) + Eventually(func() map[string]string { + if err := k8sClient.Get(ctx, secondNodeLookupKey, secondNode); err != nil { + return nil + } + return secondNode.Annotations + }, timeout, interval).Should(HaveKeyWithValue(donorAnnotation, firstNodeName)) Eventually(func() error { if err := k8sClient.Get(ctx, nodeVersionLookupKey, nodeVersion); err != nil {