Browse Source

mempool: assert -> require in test

pull/918/head
Ethan Buchman 7 years ago
parent
commit
d2db202a2d
1 changed files with 5 additions and 6 deletions
  1. +5
    -6
      mempool/mempool_test.go

+ 5
- 6
mempool/mempool_test.go View File

@ -21,7 +21,6 @@ import (
"github.com/tendermint/tendermint/proxy" "github.com/tendermint/tendermint/proxy"
"github.com/tendermint/tendermint/types" "github.com/tendermint/tendermint/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -125,7 +124,7 @@ func TestSerialReap(t *testing.T) {
appConnCon, _ := cc.NewABCIClient() appConnCon, _ := cc.NewABCIClient()
appConnCon.SetLogger(log.TestingLogger().With("module", "abci-client", "connection", "consensus")) appConnCon.SetLogger(log.TestingLogger().With("module", "abci-client", "connection", "consensus"))
err := appConnCon.Start() err := appConnCon.Start()
assert.Nil(t, err)
require.Nil(t, err)
cacheMap := make(map[string]struct{}) cacheMap := make(map[string]struct{})
deliverTxsRange := func(start, end int) { deliverTxsRange := func(start, end int) {
@ -138,21 +137,21 @@ func TestSerialReap(t *testing.T) {
err := mempool.CheckTx(txBytes, nil) err := mempool.CheckTx(txBytes, nil)
_, cached := cacheMap[string(txBytes)] _, cached := cacheMap[string(txBytes)]
if cached { if cached {
assert.NotNil(t, err, "expected error for cached tx")
require.NotNil(t, err, "expected error for cached tx")
} else { } else {
assert.Nil(t, err, "expected no err for uncached tx")
require.Nil(t, err, "expected no err for uncached tx")
} }
cacheMap[string(txBytes)] = struct{}{} cacheMap[string(txBytes)] = struct{}{}
// Duplicates are cached and should return error // Duplicates are cached and should return error
err = mempool.CheckTx(txBytes, nil) err = mempool.CheckTx(txBytes, nil)
assert.NotNil(t, err, "Expected error after CheckTx on duplicated tx")
require.NotNil(t, err, "Expected error after CheckTx on duplicated tx")
} }
} }
reapCheck := func(exp int) { reapCheck := func(exp int) {
txs := mempool.Reap(-1) txs := mempool.Reap(-1)
assert.Equal(t, len(txs), exp, cmn.Fmt("Expected to reap %v txs but got %v", exp, len(txs)))
require.Equal(t, len(txs), exp, cmn.Fmt("Expected to reap %v txs but got %v", exp, len(txs)))
} }
updateRange := func(start, end int) { updateRange := func(start, end int) {


Loading…
Cancel
Save