From ada0a4b04d7ef86b08eb29e2e85bb2fba0539ea0 Mon Sep 17 00:00:00 2001 From: Nuckal777 Date: Thu, 21 Sep 2023 11:47:55 +0200 Subject: [PATCH] Fix flaky test --- .github/workflows/test.yaml | 2 +- internal/controllers/vpa_controller_test.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1571e59..b8c4a3e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -63,7 +63,7 @@ jobs: - name: Install Ginkgo CLI run: | - go install github.com/onsi/ginkgo/v2/ginkgo@v2.12.0 + go install github.com/onsi/ginkgo/v2/ginkgo@v2.12.1 go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20230720032208-b1d6919d3e12 - name: Run tests diff --git a/internal/controllers/vpa_controller_test.go b/internal/controllers/vpa_controller_test.go index b78bf0e..651c435 100644 --- a/internal/controllers/vpa_controller_test.go +++ b/internal/controllers/vpa_controller_test.go @@ -89,7 +89,9 @@ var _ = Describe("VpaController", func() { Expect(k8sClient.Get(context.Background(), name, &vpa)).To(Succeed()) unmodified := vpa.DeepCopy() vpa.Labels = map[string]string{"cloud.sap/reconcile": "please"} - Expect(k8sClient.Patch(context.Background(), &vpa, client.MergeFrom(unmodified))).To(Succeed()) + Expect(k8sClient.Patch(context.Background(), &vpa, client.MergeFrom(unmodified))).To( + Satisfy(func(err error) bool { return err == nil || errors.IsNotFound(err) }), + ) Eventually(func(g Gomega) bool { err := k8sClient.Get(context.Background(), name, &vpa)