|
@ -69,6 +69,10 @@ func configSetup(t *testing.T) *config.Config { |
|
|
require.NoError(t, err) |
|
|
require.NoError(t, err) |
|
|
t.Cleanup(func() { os.RemoveAll(configByzantineTest.RootDir) }) |
|
|
t.Cleanup(func() { os.RemoveAll(configByzantineTest.RootDir) }) |
|
|
|
|
|
|
|
|
|
|
|
walDir := filepath.Dir(cfg.Consensus.WalFile()) |
|
|
|
|
|
ensureDir(t, walDir, 0700) |
|
|
|
|
|
t.Cleanup(func() { os.RemoveAll(walDir) }) |
|
|
|
|
|
|
|
|
return cfg |
|
|
return cfg |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -785,6 +789,7 @@ func makeConsensusState( |
|
|
configOpts ...func(*config.Config), |
|
|
configOpts ...func(*config.Config), |
|
|
) ([]*State, cleanupFunc) { |
|
|
) ([]*State, cleanupFunc) { |
|
|
t.Helper() |
|
|
t.Helper() |
|
|
|
|
|
tempDir := t.TempDir() |
|
|
|
|
|
|
|
|
valSet, privVals := factory.ValidatorSet(ctx, t, nValidators, 30) |
|
|
valSet, privVals := factory.ValidatorSet(ctx, t, nValidators, 30) |
|
|
genDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, nil) |
|
|
genDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, nil) |
|
@ -799,7 +804,7 @@ func makeConsensusState( |
|
|
blockStore := store.NewBlockStore(dbm.NewMemDB()) // each state needs its own db
|
|
|
blockStore := store.NewBlockStore(dbm.NewMemDB()) // each state needs its own db
|
|
|
state, err := sm.MakeGenesisState(genDoc) |
|
|
state, err := sm.MakeGenesisState(genDoc) |
|
|
require.NoError(t, err) |
|
|
require.NoError(t, err) |
|
|
thisConfig, err := ResetConfig(t.TempDir(), fmt.Sprintf("%s_%d", testName, i)) |
|
|
|
|
|
|
|
|
thisConfig, err := ResetConfig(tempDir, fmt.Sprintf("%s_%d", testName, i)) |
|
|
require.NoError(t, err) |
|
|
require.NoError(t, err) |
|
|
|
|
|
|
|
|
configRootDirs = append(configRootDirs, thisConfig.RootDir) |
|
|
configRootDirs = append(configRootDirs, thisConfig.RootDir) |
|
@ -808,7 +813,9 @@ func makeConsensusState( |
|
|
opt(thisConfig) |
|
|
opt(thisConfig) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ensureDir(t, filepath.Dir(thisConfig.Consensus.WalFile()), 0700) // dir for wal
|
|
|
|
|
|
|
|
|
walDir := filepath.Dir(thisConfig.Consensus.WalFile()) |
|
|
|
|
|
ensureDir(t, walDir, 0700) |
|
|
|
|
|
configRootDirs = append(configRootDirs, walDir) |
|
|
|
|
|
|
|
|
app := kvstore.NewApplication() |
|
|
app := kvstore.NewApplication() |
|
|
closeFuncs = append(closeFuncs, app.Close) |
|
|
closeFuncs = append(closeFuncs, app.Close) |
|
|