Browse Source

consensus: ensure dir for cswal on reactor tests

pull/314/head
Ethan Buchman 8 years ago
parent
commit
5f55ed2a40
2 changed files with 8 additions and 2 deletions
  1. +6
    -0
      consensus/common_test.go
  2. +2
    -2
      consensus/reactor_test.go

+ 6
- 0
consensus/common_test.go View File

@ -8,6 +8,7 @@ import (
"testing" "testing"
"time" "time"
. "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"
bc "github.com/tendermint/tendermint/blockchain" bc "github.com/tendermint/tendermint/blockchain"
@ -255,6 +256,11 @@ func randConsensusNet(nValidators int) []*ConsensusState {
state.Save() state.Save()
css[i] = newConsensusState(state, privVals[i], counter.NewCounterApplication(true)) css[i] = newConsensusState(state, privVals[i], counter.NewCounterApplication(true))
} }
// we use memdb, but need a dir for the cswal.
// in this case they all write to the same one but we dont care
// NOTE: they all share a pointer to the same config object!
EnsureDir(css[0].config.GetString("db_dir"), 0700)
return css return css
} }


+ 2
- 2
consensus/reactor_test.go View File

@ -35,7 +35,7 @@ func resetConfigTimeouts() {
// config.Set("timeout_commit", 1000) // config.Set("timeout_commit", 1000)
} }
func _TestReactor(t *testing.T) {
func TestReactor(t *testing.T) {
resetConfigTimeouts() resetConfigTimeouts()
N := 4 N := 4
css := randConsensusNet(N) css := randConsensusNet(N)
@ -85,7 +85,7 @@ func _TestReactor(t *testing.T) {
} }
} }
func _TestByzantine(t *testing.T) {
func TestByzantine(t *testing.T) {
resetConfigTimeouts() resetConfigTimeouts()
N := 4 N := 4
css := randConsensusNet(N) css := randConsensusNet(N)


Loading…
Cancel
Save