From 89cdc4bfd7fe170c13b17e97bf7583c7f33e9aa3 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Fri, 29 May 2020 10:02:24 +0400 Subject: [PATCH] consensus: increase ensureTimeout (#4891) attempt to fix #4270 TestMempoolProgressAfterCreateEmptyBlocksInterval and other tests which rely on ensureTimeout --- consensus/common_test.go | 2 +- consensus/mempool_test.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/consensus/common_test.go b/consensus/common_test.go index 31b17ffeb..235a420a2 100644 --- a/consensus/common_test.go +++ b/consensus/common_test.go @@ -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) { diff --git a/consensus/mempool_test.go b/consensus/mempool_test.go index 8e268d444..fcba73f13 100644 --- a/consensus/mempool_test.go +++ b/consensus/mempool_test.go @@ -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 ...