Skip to content

Commit

Permalink
Fix test flake
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Olshevski committed Dec 15, 2023
1 parent 8e2e2cc commit 798a671
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions internal/controllers/synthesis/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
})

Expand Down

0 comments on commit 798a671

Please sign in to comment.