From a88ef1e954938f45329d83b294c2553a2c7e9406 Mon Sep 17 00:00:00 2001 From: WeichengWang1 <124144418+WeichengWang1@users.noreply.github.com> Date: Thu, 19 Oct 2023 18:01:18 +0800 Subject: [PATCH] fix: resource consist ut, get svc just after creation might return 404 (#109) --- .../resourceconsist/resourceconsist_controller_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/controllers/resourceconsist/resourceconsist_controller_test.go b/pkg/controllers/resourceconsist/resourceconsist_controller_test.go index a5d869a0..74005b70 100644 --- a/pkg/controllers/resourceconsist/resourceconsist_controller_test.go +++ b/pkg/controllers/resourceconsist/resourceconsist_controller_test.go @@ -85,10 +85,13 @@ var _ = Describe("resource-consist-controller", func() { Expect(err).NotTo(HaveOccurred()) Eventually(func() bool { svcTmp := corev1.Service{} - Expect(mgr.GetClient().Get(context.TODO(), types.NamespacedName{ + err = mgr.GetClient().Get(context.TODO(), types.NamespacedName{ Name: svc0.Name, Namespace: svc0.Namespace, - }, &svcTmp)).Should(BeNil()) + }, &svcTmp) + if err != nil { + return false + } for _, flz := range svcTmp.GetFinalizers() { if flz == cleanFinalizerPrefix+svc0.GetName() { return true