Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg committed Jun 25, 2024
1 parent 5235cb2 commit bbd0e5d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions sync/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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)
Expand Down

0 comments on commit bbd0e5d

Please sign in to comment.