Skip to content

Commit

Permalink
Fix mocks and generate commands
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Oct 2, 2022
1 parent e7e4106 commit 66c4cca
Show file tree
Hide file tree
Showing 14 changed files with 417 additions and 676 deletions.
45 changes: 0 additions & 45 deletions dot/network/mock_block_state_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions dot/network/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ func createTestService(t *testing.T, cfg *Config) (srvc *Service) {
blockstate.EXPECT().BestBlockHeader().Return(header, nil).AnyTimes()
blockstate.EXPECT().GetHighestFinalisedHeader().Return(header, nil).AnyTimes()
blockstate.EXPECT().GenesisHash().Return(common.NewHash([]byte{})).AnyTimes()
blockstate.EXPECT().BestBlockNumber().Return(uint(1), nil).AnyTimes()

blockstate.EXPECT().HasBlockBody(
gomock.AssignableToTypeOf(common.Hash([32]byte{}))).Return(false, nil).AnyTimes()
blockstate.EXPECT().GetHashByNumber(gomock.Any()).Return(common.Hash{}, nil).AnyTimes()

cfg.BlockState = blockstate
}
Expand Down
46 changes: 0 additions & 46 deletions dot/peerset/mock_message_processor_test.go

This file was deleted.

2 changes: 0 additions & 2 deletions dot/peerset/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ const (

const allocTimeDuration = 2 * time.Second

//go:generate mockgen -destination=mock_message_processor_test.go -package $GOPACKAGE . MessageProcessor

func newTestPeerSet(t *testing.T, maxIn, maxOut uint32, bootNodes,
reservedPeers []peer.ID, reservedOnly bool) *Handler {
t.Helper()
Expand Down
10 changes: 5 additions & 5 deletions dot/sync/chain_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func Test_chainProcessor_handleBlock(t *testing.T) {
mockBlockState.EXPECT().GetHeader(common.Hash{}).Return(&types.Header{
StateRoot: testHash,
}, nil)
mockInstance := NewMockRuntimeInstance(ctrl)
mockInstance := NewMockInstance(ctrl)
mockInstance.EXPECT().SetContextStorage(trieState)
mockInstance.EXPECT().ExecuteBlock(&types.Block{Body: types.Body{}}).Return(nil, mockError)
mockBlockState.EXPECT().GetRuntime(&testParentHash).Return(mockInstance, nil)
Expand All @@ -110,7 +110,7 @@ func Test_chainProcessor_handleBlock(t *testing.T) {
StateRoot: testHash,
}, nil)
mockBlock := &types.Block{Body: types.Body{}}
mockInstance := NewMockRuntimeInstance(ctrl)
mockInstance := NewMockInstance(ctrl)
mockInstance.EXPECT().SetContextStorage(trieState)
mockInstance.EXPECT().ExecuteBlock(mockBlock).Return(nil, nil)
mockBlockState.EXPECT().GetRuntime(&testParentHash).Return(mockInstance, nil)
Expand Down Expand Up @@ -145,7 +145,7 @@ func Test_chainProcessor_handleBlock(t *testing.T) {
mockHeaderHash := mockHeader.Hash()
mockBlockState.EXPECT().GetHeader(common.Hash{}).Return(mockHeader, nil)

mockInstance := NewMockRuntimeInstance(ctrl)
mockInstance := NewMockInstance(ctrl)
mockInstance.EXPECT().SetContextStorage(trieState)
mockInstance.EXPECT().ExecuteBlock(mockBlock).Return(nil, nil)
mockBlockState.EXPECT().GetRuntime(&mockHeaderHash).Return(mockInstance, nil)
Expand Down Expand Up @@ -681,7 +681,7 @@ func Test_chainProcessor_processBlockData(t *testing.T) {
runtimeHash := common.MustHexToHash("0x7db9db5ed9967b80143100189ba69d9e4deab85ac3570e5df25686cabe32964a")
mockBlock := &types.Block{Header: types.Header{}, Body: types.Body{}}

mockInstance := NewMockRuntimeInstance(ctrl)
mockInstance := NewMockInstance(ctrl)
mockInstance.EXPECT().SetContextStorage(mockTrieState)
mockInstance.EXPECT().ExecuteBlock(mockBlock).Return(nil, nil)
mockBlockState := NewMockBlockState(ctrl)
Expand Down Expand Up @@ -725,7 +725,7 @@ func Test_chainProcessor_processBlockData(t *testing.T) {
mockTrieState := storage.NewTrieState(nil)
mockBlock := &types.Block{Header: types.Header{}, Body: types.Body{}}

mockInstance := NewMockRuntimeInstance(ctrl)
mockInstance := NewMockInstance(ctrl)
mockInstance.EXPECT().SetContextStorage(mockTrieState)
mockInstance.EXPECT().ExecuteBlock(mockBlock).Return(nil, nil)
mockBlockState := NewMockBlockState(ctrl)
Expand Down
28 changes: 0 additions & 28 deletions dot/sync/mock_disjoint_block_set_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 66c4cca

Please sign in to comment.