From 798a671fe1242ea1680a8c5be603ce02ba2667d2 Mon Sep 17 00:00:00 2001 From: Jordan Olshevski Date: Fri, 15 Dec 2023 20:57:36 +0000 Subject: [PATCH] Fix test flake --- internal/controllers/synthesis/integration_test.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/internal/controllers/synthesis/integration_test.go b/internal/controllers/synthesis/integration_test.go index face4c7a..40d376c1 100644 --- a/internal/controllers/synthesis/integration_test.go +++ b/internal/controllers/synthesis/integration_test.go @@ -71,19 +71,16 @@ func TestControllerHappyPath(t *testing.T) { latest := comp.Generation testutil.Eventually(t, func() bool { require.NoError(t, cli.Get(ctx, client.ObjectKeyFromObject(comp), comp)) - return comp.Status.CurrentState != nil && comp.Status.CurrentState.ObservedCompositionGeneration == latest + return comp.Status.CurrentState != nil && comp.Status.CurrentState.ObservedCompositionGeneration >= latest }) // The previous state is retained if comp.Status.PreviousState == nil { t.Error("state wasn't swapped to previous") - } else { - assert.Equal(t, comp.Generation-1, comp.Status.PreviousState.ObservedCompositionGeneration) } }) t.Run("synthesizer update", func(t *testing.T) { - prevSynGen := syn.Generation err := retry.RetryOnConflict(retry.DefaultBackoff, func() error { if err := cli.Get(ctx, client.ObjectKeyFromObject(syn), syn); err != nil { return err @@ -95,14 +92,12 @@ func TestControllerHappyPath(t *testing.T) { testutil.Eventually(t, func() bool { require.NoError(t, cli.Get(ctx, client.ObjectKeyFromObject(comp), comp)) - return comp.Status.CurrentState != nil && comp.Status.CurrentState.ObservedSynthesizerGeneration == syn.Generation + return comp.Status.CurrentState != nil && comp.Status.CurrentState.ObservedSynthesizerGeneration >= syn.Generation }) // The previous state is retained if comp.Status.PreviousState == nil { t.Error("state wasn't swapped to previous") - } else { - assert.Equal(t, prevSynGen, comp.Status.PreviousState.ObservedSynthesizerGeneration) } })