Skip to content

Commit

Permalink
test: fix flaky Snapshotter test (backport #21878) (#21880)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Peters <[email protected]>
  • Loading branch information
mergify[bot] and alpe authored Sep 24, 2024
1 parent 3bb848d commit 241791f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions x/auth/ante/unorderedtx/snapshotter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ func TestSnapshotter(t *testing.T) {

// start the manager and wait a bit for the background purge loop to run
txm2.Start()
time.Sleep(time.Millisecond * 5)
txm2.OnNewBlock(currentTime.Add(time.Second * 200))
time.Sleep(time.Second * 5) // the loop runs every 5 seconds, so we need to wait for that
require.Equal(t, 0, txm2.Size())
txm2.OnNewBlock(currentTime.Add(time.Second * 200)) // blocks until channel is read in purge loop
// the loop runs every 5 seconds, so we need to wait for that
require.Eventually(t, func() bool { return txm2.Size() == 0 }, 6*time.Second, 500*time.Millisecond)

// restore with timestamp < timeout time which should result in all unordered txs synced
txm3 := unorderedtx.NewManager(dataDir)
Expand Down

0 comments on commit 241791f

Please sign in to comment.