test: use temporary folder in tests (#14246)
This commit is contained in:
parent
42d24d4064
commit
b9511b9205
@ -44,7 +44,7 @@ func TestSimAppExportAndBlockedAddrs(t *testing.T) {
|
||||
app := NewSimappWithCustomOptions(t, false, SetupOptions{
|
||||
Logger: logger,
|
||||
DB: db,
|
||||
AppOpts: simtestutil.NewAppOptionsWithFlagHome(DefaultNodeHome),
|
||||
AppOpts: simtestutil.NewAppOptionsWithFlagHome(t.TempDir()),
|
||||
})
|
||||
|
||||
// BlockedAddresses returns a map of addresses in app v1 and a map of modules name in app v2.
|
||||
@ -67,7 +67,7 @@ func TestSimAppExportAndBlockedAddrs(t *testing.T) {
|
||||
|
||||
logger2 := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
|
||||
// Making a new app object with the db, so that initchain hasn't been called
|
||||
app2 := NewSimApp(logger2, db, nil, true, simtestutil.NewAppOptionsWithFlagHome(DefaultNodeHome))
|
||||
app2 := NewSimApp(logger2, db, nil, true, simtestutil.NewAppOptionsWithFlagHome(t.TempDir()))
|
||||
_, err := app2.ExportAppStateAndValidators(false, []string{}, []string{})
|
||||
require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
|
||||
}
|
||||
@ -75,7 +75,7 @@ func TestSimAppExportAndBlockedAddrs(t *testing.T) {
|
||||
func TestRunMigrations(t *testing.T) {
|
||||
db := dbm.NewMemDB()
|
||||
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
|
||||
app := NewSimApp(logger, db, nil, true, simtestutil.NewAppOptionsWithFlagHome(DefaultNodeHome))
|
||||
app := NewSimApp(logger, db, nil, true, simtestutil.NewAppOptionsWithFlagHome(t.TempDir()))
|
||||
|
||||
// Create a new baseapp and configurator for the purpose of this test.
|
||||
bApp := baseapp.NewBaseApp(app.Name(), logger, db, app.TxConfig().TxDecoder())
|
||||
@ -209,7 +209,7 @@ func TestRunMigrations(t *testing.T) {
|
||||
func TestInitGenesisOnMigration(t *testing.T) {
|
||||
db := dbm.NewMemDB()
|
||||
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
|
||||
app := NewSimApp(logger, db, nil, true, simtestutil.NewAppOptionsWithFlagHome(DefaultNodeHome))
|
||||
app := NewSimApp(logger, db, nil, true, simtestutil.NewAppOptionsWithFlagHome(t.TempDir()))
|
||||
ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})
|
||||
|
||||
// Create a mock module. This module will serve as the new module we're
|
||||
@ -255,7 +255,7 @@ func TestUpgradeStateOnGenesis(t *testing.T) {
|
||||
app := NewSimappWithCustomOptions(t, false, SetupOptions{
|
||||
Logger: logger,
|
||||
DB: db,
|
||||
AppOpts: simtestutil.NewAppOptionsWithFlagHome(DefaultNodeHome),
|
||||
AppOpts: simtestutil.NewAppOptionsWithFlagHome(t.TempDir()),
|
||||
})
|
||||
|
||||
// make sure the upgrade keeper has version map in state
|
||||
|
||||
@ -18,7 +18,7 @@ func TestRollback(t *testing.T) {
|
||||
options := simapp.SetupOptions{
|
||||
Logger: log.NewNopLogger(),
|
||||
DB: db,
|
||||
AppOpts: simtestutil.NewAppOptionsWithFlagHome(simapp.DefaultNodeHome),
|
||||
AppOpts: simtestutil.NewAppOptionsWithFlagHome(t.TempDir()),
|
||||
}
|
||||
app := simapp.NewSimappWithCustomOptions(t, false, options)
|
||||
app.Commit()
|
||||
@ -46,7 +46,7 @@ func TestRollback(t *testing.T) {
|
||||
require.Equal(t, target, app.LastBlockHeight())
|
||||
|
||||
// recreate app to have clean check state
|
||||
app = simapp.NewSimApp(options.Logger, options.DB, nil, true, simtestutil.NewAppOptionsWithFlagHome(simapp.DefaultNodeHome))
|
||||
app = simapp.NewSimApp(options.Logger, options.DB, nil, true, simtestutil.NewAppOptionsWithFlagHome(t.TempDir()))
|
||||
store = app.NewContext(true, tmproto.Header{}).KVStore(app.GetKey("bank"))
|
||||
require.Equal(t, []byte("value5"), store.Get([]byte("key")))
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user