Skip to content

Commit

Permalink
fix mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph committed Aug 23, 2023
1 parent 0f61404 commit e1829bb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
3 changes: 3 additions & 0 deletions vms/proposervm/batched_vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,9 @@ func initTestRemoteProposerVM(
return nil, errUnknownBlock
}
}
coreVM.VerifyHeightIndexF = func(context.Context) error {
return nil
}

proVM := New(
coreVM,
Expand Down
23 changes: 22 additions & 1 deletion vms/proposervm/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,9 @@ func TestExpiredBuildBlock(t *testing.T) {
toScheduler = toEngineChan
return nil
}
coreVM.VerifyHeightIndexF = func(context.Context) error {
return nil
}

// make sure that DBs are compressed correctly
require.NoError(proVM.Initialize(
Expand Down Expand Up @@ -1201,6 +1204,9 @@ func TestInnerVMRollback(t *testing.T) {
) error {
return nil
}
coreVM.VerifyHeightIndexF = func(context.Context) error {
return nil
}

dbManager := manager.NewMemDB(version.Semantic1_0_0)

Expand All @@ -1226,7 +1232,6 @@ func TestInnerVMRollback(t *testing.T) {
))

require.NoError(proVM.SetState(context.Background(), snow.NormalOp))

require.NoError(proVM.SetPreference(context.Background(), coreGenBlk.IDV))

coreBlk := &snowman.TestBlock{
Expand Down Expand Up @@ -2168,8 +2173,16 @@ func TestVMInnerBlkCache(t *testing.T) {
gomock.Any(),
gomock.Any(),
).Return(nil)
innerVM.EXPECT().VerifyHeightIndex(gomock.Any()).Return(nil)
innerVM.EXPECT().Shutdown(gomock.Any()).Return(nil)

{
innerBlk := snowman.NewMockBlock(ctrl)
innerBlkID := ids.GenerateTestID()
innerVM.EXPECT().LastAccepted(gomock.Any()).Return(innerBlkID, nil)
innerVM.EXPECT().GetBlock(gomock.Any(), innerBlkID).Return(innerBlk, nil)
}

ctx := snow.DefaultContextTest()
ctx.NodeID = ids.NodeIDFromCert(pTestCert.Leaf)

Expand Down Expand Up @@ -2392,8 +2405,16 @@ func TestVM_VerifyBlockWithContext(t *testing.T) {
gomock.Any(),
gomock.Any(),
).Return(nil)
innerVM.EXPECT().VerifyHeightIndex(gomock.Any()).Return(nil)
innerVM.EXPECT().Shutdown(gomock.Any()).Return(nil)

{
innerBlk := snowman.NewMockBlock(ctrl)
innerBlkID := ids.GenerateTestID()
innerVM.EXPECT().LastAccepted(gomock.Any()).Return(innerBlkID, nil)
innerVM.EXPECT().GetBlock(gomock.Any(), innerBlkID).Return(innerBlk, nil)
}

snowCtx := snow.DefaultContextTest()
snowCtx.NodeID = ids.NodeIDFromCert(pTestCert.Leaf)

Expand Down

0 comments on commit e1829bb

Please sign in to comment.