Browse Source

test: increase proposal timeout

pull/330/head
Ethan Buchman 8 years ago
parent
commit
8df32cd540
3 changed files with 18 additions and 16 deletions
  1. +0
    -1
      consensus/byzantine_test.go
  2. +18
    -0
      consensus/common_test.go
  3. +0
    -15
      consensus/reactor_test.go

+ 0
- 1
consensus/byzantine_test.go View File

@ -29,7 +29,6 @@ func init() {
// Byzantine validator refuses to prevote. // Byzantine validator refuses to prevote.
// Heal partition and ensure A sees the commit // Heal partition and ensure A sees the commit
func TestByzantine(t *testing.T) { func TestByzantine(t *testing.T) {
resetConfigTimeouts()
N := 4 N := 4
css := randConsensusNet(N) css := randConsensusNet(N)


+ 18
- 0
consensus/common_test.go View File

@ -12,6 +12,7 @@ import (
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
cfg "github.com/tendermint/go-config" cfg "github.com/tendermint/go-config"
dbm "github.com/tendermint/go-db" dbm "github.com/tendermint/go-db"
"github.com/tendermint/go-logger"
"github.com/tendermint/go-p2p" "github.com/tendermint/go-p2p"
bc "github.com/tendermint/tendermint/blockchain" bc "github.com/tendermint/tendermint/blockchain"
"github.com/tendermint/tendermint/config/tendermint_test" "github.com/tendermint/tendermint/config/tendermint_test"
@ -264,6 +265,7 @@ func randConsensusNet(nValidators int) []*ConsensusState {
state := sm.MakeGenesisState(db, genDoc) state := sm.MakeGenesisState(db, genDoc)
state.Save() state.Save()
thisConfig := tendermint_test.ResetConfig(Fmt("consensus_reactor_test_%d", i)) thisConfig := tendermint_test.ResetConfig(Fmt("consensus_reactor_test_%d", i))
resetConfigTimeouts(thisConfig)
EnsureDir(thisConfig.GetString("cs_wal_dir"), 0700) // dir for wal EnsureDir(thisConfig.GetString("cs_wal_dir"), 0700) // dir for wal
css[i] = newConsensusStateWithConfig(thisConfig, state, privVals[i], counter.NewCounterApplication(true)) css[i] = newConsensusStateWithConfig(thisConfig, state, privVals[i], counter.NewCounterApplication(true))
} }
@ -279,6 +281,7 @@ func randConsensusNetWithPeers(nValidators int, nPeers int) []*ConsensusState {
state := sm.MakeGenesisState(db, genDoc) state := sm.MakeGenesisState(db, genDoc)
state.Save() state.Save()
thisConfig := tendermint_test.ResetConfig(Fmt("consensus_reactor_test_%d", i)) thisConfig := tendermint_test.ResetConfig(Fmt("consensus_reactor_test_%d", i))
resetConfigTimeouts(thisConfig)
EnsureDir(thisConfig.GetString("cs_wal_dir"), 0700) // dir for wal EnsureDir(thisConfig.GetString("cs_wal_dir"), 0700) // dir for wal
var privVal *types.PrivValidator var privVal *types.PrivValidator
if i < nValidators { if i < nValidators {
@ -367,3 +370,18 @@ func getSwitchIndex(switches []*p2p.Switch, peer *p2p.Peer) int {
panic("didnt find peer in switches") panic("didnt find peer in switches")
return -1 return -1
} }
// so we dont violate synchrony assumptions
// TODO: make tests more robust to this instead (handle round changes)
// XXX: especially a problem when running the race detector
func resetConfigTimeouts(config cfg.Config) {
logger.SetLogLevel("info")
//config.Set("log_level", "notice")
config.Set("timeout_propose", 10000) // TODO
// config.Set("timeout_propose_delta", 500)
// config.Set("timeout_prevote", 1000)
// config.Set("timeout_prevote_delta", 500)
// config.Set("timeout_precommit", 1000)
// config.Set("timeout_precommit_delta", 500)
config.Set("timeout_commit", 1000)
}

+ 0
- 15
consensus/reactor_test.go View File

@ -9,7 +9,6 @@ import (
"github.com/tendermint/tendermint/config/tendermint_test" "github.com/tendermint/tendermint/config/tendermint_test"
"github.com/tendermint/go-events" "github.com/tendermint/go-events"
"github.com/tendermint/go-logger"
"github.com/tendermint/go-p2p" "github.com/tendermint/go-p2p"
"github.com/tendermint/tendermint/types" "github.com/tendermint/tendermint/types"
"github.com/tendermint/tmsp/example/dummy" "github.com/tendermint/tmsp/example/dummy"
@ -19,24 +18,11 @@ func init() {
config = tendermint_test.ResetConfig("consensus_reactor_test") config = tendermint_test.ResetConfig("consensus_reactor_test")
} }
func resetConfigTimeouts() {
logger.SetLogLevel("info")
//config.Set("log_level", "notice")
config.Set("timeout_propose", 2000)
// config.Set("timeout_propose_delta", 500)
// config.Set("timeout_prevote", 1000)
// config.Set("timeout_prevote_delta", 500)
// config.Set("timeout_precommit", 1000)
// config.Set("timeout_precommit_delta", 500)
config.Set("timeout_commit", 1000)
}
//---------------------------------------------- //----------------------------------------------
// in-process testnets // in-process testnets
// Ensure a testnet makes blocks // Ensure a testnet makes blocks
func TestReactor(t *testing.T) { func TestReactor(t *testing.T) {
resetConfigTimeouts()
N := 4 N := 4
css := randConsensusNet(N) css := randConsensusNet(N)
reactors := make([]*ConsensusReactor, N) reactors := make([]*ConsensusReactor, N)
@ -70,7 +56,6 @@ func TestReactor(t *testing.T) {
// ensure we can make blocks despite cycling a validator set // ensure we can make blocks despite cycling a validator set
func TestValidatorSetChanges(t *testing.T) { func TestValidatorSetChanges(t *testing.T) {
resetConfigTimeouts()
nPeers := 8 nPeers := 8
nVals := 4 nVals := 4
css := randConsensusNetWithPeers(nVals, nPeers) css := randConsensusNetWithPeers(nVals, nPeers)


Loading…
Cancel
Save