Browse Source

replace old mocks with new mock

pull/4743/head
Callum 5 years ago
parent
commit
6dc971052a
4 changed files with 5 additions and 22 deletions
  1. +4
    -3
      state/execution_test.go
  2. +0
    -9
      state/helpers_test.go
  3. +0
    -9
      state/services.go
  4. +1
    -1
      state/validation_test.go

+ 4
- 3
state/execution_test.go View File

@ -12,6 +12,7 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/crypto/secp256k1"
evmock "github.com/tendermint/tendermint/evidence/mock"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/mock"
"github.com/tendermint/tendermint/proxy"
@ -38,7 +39,7 @@ func TestApplyBlock(t *testing.T) {
state, stateDB, _ := makeState(1, 1)
blockExec := sm.NewBlockExecutor(stateDB, log.TestingLogger(), proxyApp.Consensus(),
mock.Mempool{}, sm.MockEvidencePool{})
mock.Mempool{}, evmock.NewDefaultEvidencePool())
block := makeBlock(state, 1)
blockID := types.BlockID{Hash: block.Hash(), PartsHeader: block.MakePartSet(testPartSize).Header()}
@ -334,7 +335,7 @@ func TestEndBlockValidatorUpdates(t *testing.T) {
log.TestingLogger(),
proxyApp.Consensus(),
mock.Mempool{},
sm.MockEvidencePool{},
evmock.NewDefaultEvidencePool(),
)
eventBus := types.NewEventBus()
@ -401,7 +402,7 @@ func TestEndBlockValidatorUpdatesResultingInEmptySet(t *testing.T) {
log.TestingLogger(),
proxyApp.Consensus(),
mock.Mempool{},
sm.MockEvidencePool{},
evmock.NewDefaultEvidencePool(),
)
block := makeBlock(state, 1)


+ 0
- 9
state/helpers_test.go View File

@ -22,15 +22,6 @@ type paramsChangeTestCase struct {
params types.ConsensusParams
}
// always returns true if asked if any evidence was already committed.
type mockEvPoolAlwaysCommitted struct{}
func (m mockEvPoolAlwaysCommitted) PendingEvidence(int64) []types.Evidence { return nil }
func (m mockEvPoolAlwaysCommitted) AddEvidence(types.Evidence) error { return nil }
func (m mockEvPoolAlwaysCommitted) Update(*types.Block, sm.State) {}
func (m mockEvPoolAlwaysCommitted) IsCommitted(types.Evidence) bool { return true }
func (m mockEvPoolAlwaysCommitted) IsPending(types.Evidence) bool { return false }
func newTestApp() proxy.AppConns {
app := &testApp{}
cc := proxy.NewLocalClientCreator(app)


+ 0
- 9
state/services.go View File

@ -45,12 +45,3 @@ type EvidencePool interface {
IsCommitted(types.Evidence) bool
IsPending(types.Evidence) bool
}
// MockEvidencePool is an empty implementation of EvidencePool, useful for testing.
type MockEvidencePool struct{}
func (m MockEvidencePool) PendingEvidence(int64) []types.Evidence { return nil }
func (m MockEvidencePool) AddEvidence(types.Evidence) error { return nil }
func (m MockEvidencePool) Update(*types.Block, State) {}
func (m MockEvidencePool) IsCommitted(types.Evidence) bool { return false }
func (m MockEvidencePool) IsPending(types.Evidence) bool { return false }

+ 1
- 1
state/validation_test.go View File

@ -29,7 +29,7 @@ func TestValidateBlockHeader(t *testing.T) {
log.TestingLogger(),
proxyApp.Consensus(),
mock.Mempool{},
sm.MockEvidencePool{},
evmock.NewDefaultEvidencePool(),
)
lastCommit := types.NewCommit(0, 0, types.BlockID{}, nil)


Loading…
Cancel
Save