From 4c2b8d5f1c0fea3142cd6d58081f180aece25974 Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Thu, 14 Aug 2025 10:49:09 +0200 Subject: [PATCH] [test] Fix race condition in watcher disable test Wrap OpenStackControlPlane spec update in Eventually block to handle potential conflicts from concurrent updates. Fixes HTTP 409 conflict error: 'the object has been modified; please apply your changes to the latest version and try again' randomly seen in running the functional test. Signed-off-by: Martin Schuppert --- .../ctlplane/openstackoperator_controller_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/functional/ctlplane/openstackoperator_controller_test.go b/tests/functional/ctlplane/openstackoperator_controller_test.go index 738fd9acbc..7f4b41c0be 100644 --- a/tests/functional/ctlplane/openstackoperator_controller_test.go +++ b/tests/functional/ctlplane/openstackoperator_controller_test.go @@ -2257,9 +2257,11 @@ var _ = Describe("OpenStackOperator controller", func() { g.Expect(watcher).Should(Not(BeNil())) }, timeout, interval).Should(Succeed()) - OSCtlplane := GetOpenStackControlPlane(names.OpenStackControlplaneName) - OSCtlplane.Spec.Watcher.Enabled = false - Expect(th.K8sClient.Update(th.Ctx, OSCtlplane)).Should(Succeed()) + Eventually(func(g Gomega) { + OSCtlplane := GetOpenStackControlPlane(names.OpenStackControlplaneName) + OSCtlplane.Spec.Watcher.Enabled = false + g.Expect(th.K8sClient.Update(th.Ctx, OSCtlplane)).Should(Succeed()) + }, timeout, interval).Should(Succeed()) Eventually(func(g Gomega) { instance := &watcherv1.Watcher{}