From 6d1fd6e889d337d5e3cecc0040fec74c8d726491 Mon Sep 17 00:00:00 2001 From: tgolang Date: Sat, 8 Mar 2025 16:15:02 +0800 Subject: [PATCH] refactor: use t.TempDir() instead of os.MkdirTemp Signed-off-by: tgolang --- baseapp/deliver_tx_test.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/baseapp/deliver_tx_test.go b/baseapp/deliver_tx_test.go index 4a5ddd88..d0e0804d 100644 --- a/baseapp/deliver_tx_test.go +++ b/baseapp/deliver_tx_test.go @@ -8,7 +8,6 @@ import ( "errors" "fmt" "math/rand" - "os" "strings" "sync" "testing" @@ -1850,13 +1849,9 @@ func setupBaseAppWithSnapshots(t *testing.T, blocks uint, blockTxs int, options snapshotInterval := uint64(2) snapshotTimeout := 1 * time.Minute - snapshotDir, err := os.MkdirTemp("", "baseapp") - require.NoError(t, err) + snapshotDir := t.TempDir() snapshotStore, err := snapshots.NewStore(dbm.NewMemDB(), snapshotDir) require.NoError(t, err) - teardown := func() { - os.RemoveAll(snapshotDir) - } app := setupBaseApp(t, append(options, SetSnapshotStore(snapshotStore), @@ -1909,7 +1904,7 @@ func setupBaseAppWithSnapshots(t *testing.T, blocks uint, blockTxs int, options } } - return app, teardown + return app, func() {} } func TestMountStores(t *testing.T) {