diff --git a/controllers/leveltriggered/controller_test.go b/controllers/leveltriggered/controller_test.go index 72b9393..b391cfe 100644 --- a/controllers/leveltriggered/controller_test.go +++ b/controllers/leveltriggered/controller_test.go @@ -27,10 +27,10 @@ const ( ) func TestReconcile(t *testing.T) { - g := testingutils.NewGomegaWithT(t) ctx := context.Background() - t.Run("sets cluster not found and cluster unready condition", func(_ *testing.T) { + t.Run("sets cluster not found and cluster unready condition", func(t *testing.T) { + g := testingutils.NewGomegaWithT(t) name := "pipeline-" + rand.String(5) clusterName := "cluster-" + rand.String(5) ns := testingutils.NewNamespace(ctx, g, k8sClient) @@ -55,6 +55,7 @@ func TestReconcile(t *testing.T) { }) t.Run("sets reconciliation succeeded condition for remote cluster", func(t *testing.T) { + g := testingutils.NewGomegaWithT(t) t.Skip("remote clusters not supported yet") name := "pipeline-" + rand.String(5) @@ -76,7 +77,8 @@ func TestReconcile(t *testing.T) { g.Expect(events[0].message).To(ContainSubstring("Updated pipeline")) }) - t.Run("sets reconciliation succeeded condition without clusterRef", func(_ *testing.T) { + t.Run("sets reconciliation succeeded condition without clusterRef", func(t *testing.T) { + g := testingutils.NewGomegaWithT(t) name := "pipeline-" + rand.String(5) ns := testingutils.NewNamespace(ctx, g, k8sClient) @@ -95,6 +97,7 @@ func TestReconcile(t *testing.T) { }) t.Run("app status is recorded faithfully", func(t *testing.T) { + g := testingutils.NewGomegaWithT(t) name := "pipeline-" + rand.String(5) ns := testingutils.NewNamespace(ctx, g, k8sClient) pipeline := newPipeline(ctx, g, name, ns.Name, nil) @@ -139,7 +142,7 @@ func getTargetStatus(g Gomega, pipeline *v1alpha1.Pipeline, envName string, targ func checkReadyCondition(ctx context.Context, g Gomega, n types.NamespacedName, status metav1.ConditionStatus, reason string) { pipeline := &v1alpha1.Pipeline{} - assrt := g.Eventually(func() []metav1.Condition { + assrt := g.EventuallyWithOffset(1, func() []metav1.Condition { err := k8sClient.Get(ctx, n, pipeline) if err != nil { return nil