Skip to content

Commit

Permalink
fix: ut build
Browse files Browse the repository at this point in the history
  • Loading branch information
goran-ethernal committed Sep 19, 2024
1 parent 8aea9de commit 1a1c447
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions sync/evmdriver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,36 +198,19 @@ func TestHandleReorg(t *testing.T) {

// happy path
_, cancel := context.WithCancel(ctx)
downloadCh := make(chan EVMBlock)
firstReorgedBlock := uint64(5)
pm.On("Reorg", ctx, firstReorgedBlock).Return(nil)
go driver.handleReorg(ctx, cancel, downloadCh, firstReorgedBlock)
close(downloadCh)
go driver.handleReorg(ctx, cancel, firstReorgedBlock)
done := <-reorgProcessed
require.True(t, done)

// download ch sends some garbage
_, cancel = context.WithCancel(ctx)
downloadCh = make(chan EVMBlock)
firstReorgedBlock = uint64(6)
pm.On("Reorg", ctx, firstReorgedBlock).Return(nil)
go driver.handleReorg(ctx, cancel, downloadCh, firstReorgedBlock)
downloadCh <- EVMBlock{}
downloadCh <- EVMBlock{}
downloadCh <- EVMBlock{}
close(downloadCh)
done = <-reorgProcessed
require.True(t, done)

// processor fails 2 times
_, cancel = context.WithCancel(ctx)
downloadCh = make(chan EVMBlock)
firstReorgedBlock = uint64(7)
pm.On("Reorg", ctx, firstReorgedBlock).Return(errors.New("foo")).Once()
pm.On("Reorg", ctx, firstReorgedBlock).Return(errors.New("foo")).Once()
pm.On("Reorg", ctx, firstReorgedBlock).Return(nil).Once()
go driver.handleReorg(ctx, cancel, downloadCh, firstReorgedBlock)
close(downloadCh)
go driver.handleReorg(ctx, cancel, firstReorgedBlock)
done = <-reorgProcessed
require.True(t, done)
}

0 comments on commit 1a1c447

Please sign in to comment.