From 562cf9749464c8312b663d846c394e9db7dace3c Mon Sep 17 00:00:00 2001 From: Yuki Iwai Date: Wed, 5 Feb 2025 12:16:36 +0900 Subject: [PATCH] ControlPlane: Fix flaky integraion testings due to missing the latest version of object (#2414) Signed-off-by: Yuki Iwai --- test/integration/controller.v2/trainjob_controller_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/integration/controller.v2/trainjob_controller_test.go b/test/integration/controller.v2/trainjob_controller_test.go index 487114d38e..8dd7b0e9c3 100644 --- a/test/integration/controller.v2/trainjob_controller_test.go +++ b/test/integration/controller.v2/trainjob_controller_test.go @@ -613,7 +613,10 @@ var _ = ginkgo.Describe("TrainJob marker validations and defaulting", ginkgo.Ord ginkgo.DescribeTable("Validate TrainJob on update", func(old func() *kubeflowv2.TrainJob, new func(*kubeflowv2.TrainJob) *kubeflowv2.TrainJob, errorMatcher gomega.OmegaMatcher) { oldTrainJob := old() gomega.Expect(k8sClient.Create(ctx, oldTrainJob)).Should(gomega.Succeed()) - gomega.Expect(k8sClient.Update(ctx, new(oldTrainJob))).Should(errorMatcher) + gomega.Eventually(func(g gomega.Gomega) { + g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(oldTrainJob), oldTrainJob)).Should(gomega.Succeed()) + g.Expect(k8sClient.Update(ctx, new(oldTrainJob))).Should(errorMatcher) + }, util.Timeout, util.Interval).Should(gomega.Succeed()) }, ginkgo.Entry("Should fail to update TrainJob managedBy", func() *kubeflowv2.TrainJob {