From bbd0e5d442b6ad2ef0661c7cd0ee22a081d20723 Mon Sep 17 00:00:00 2001 From: Oleg Kovalov Date: Tue, 25 Jun 2024 15:17:02 +0200 Subject: [PATCH] fix --- sync/sync_test.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sync/sync_test.go b/sync/sync_test.go index 17b5a36e..31124063 100644 --- a/sync/sync_test.go +++ b/sync/sync_test.go @@ -27,9 +27,15 @@ func TestSyncSimpleRequestingHead(t *testing.T) { err := remoteStore.Append(ctx, suite.GenDummyHeaders(100)...) require.NoError(t, err) - _, err = remoteStore.GetByHeight(ctx, 100) + time.Sleep(10 * time.Millisecond) + + h101, err := remoteStore.GetByHeight(ctx, 101) require.NoError(t, err) + exp, err := remoteStore.Head(ctx) + require.NoError(t, err) + require.Equal(t, exp.Height(), h101.Height()) + localStore := newTestStore(t, ctx, head) syncer, err := NewSyncer( local.NewExchange(remoteStore), @@ -47,13 +53,10 @@ func TestSyncSimpleRequestingHead(t *testing.T) { err = syncer.SyncWait(ctx) require.NoError(t, err) - exp, err := remoteStore.Head(ctx) - require.NoError(t, err) - have, err := localStore.Head(ctx) require.NoError(t, err) - assert.Equal(t, exp.Height(), have.Height()) assert.Empty(t, syncer.pending.Head()) + assert.Equal(t, exp.Height(), have.Height()) state := syncer.State() assert.Equal(t, uint64(exp.Height()), state.Height)