Browse Source

consensus: increase ensureTimeout (#4891)

attempt to fix #4270

TestMempoolProgressAfterCreateEmptyBlocksInterval and other tests which
rely on ensureTimeout
pull/4915/head
Anton Kaliaev 4 years ago
committed by GitHub
parent
commit
89cdc4bfd7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions
  1. +1
    -1
      consensus/common_test.go
  2. +4
    -2
      consensus/mempool_test.go

+ 1
- 1
consensus/common_test.go View File

@ -50,7 +50,7 @@ type cleanupFunc func()
var (
config *cfg.Config // NOTE: must be reset for each _test.go file
consensusReplayConfig *cfg.Config
ensureTimeout = time.Millisecond * 100
ensureTimeout = time.Millisecond * 200
)
func ensureDir(dir string, mode os.FileMode) {


+ 4
- 2
consensus/mempool_test.go View File

@ -45,13 +45,15 @@ func TestMempoolNoProgressUntilTxsAvailable(t *testing.T) {
func TestMempoolProgressAfterCreateEmptyBlocksInterval(t *testing.T) {
config := ResetConfig("consensus_mempool_txs_available_test")
defer os.RemoveAll(config.RootDir)
config.Consensus.CreateEmptyBlocksInterval = ensureTimeout
state, privVals := randGenesisState(1, false, 10)
cs := newStateWithConfig(config, state, privVals[0], NewCounterApplication())
assertMempool(cs.txNotifier).EnableTxsAvailable()
height, round := cs.Height, cs.Round
newBlockCh := subscribe(cs.eventBus, types.EventQueryNewBlock)
startTestRound(cs, height, round)
startTestRound(cs, cs.Height, cs.Round)
ensureNewEventOnChannel(newBlockCh) // first block gets committed
ensureNoNewEventOnChannel(newBlockCh) // then we dont make a block ...


Loading…
Cancel
Save