fix: using t.TempDir() to simplify test temp dir manager (backport #23893) (#23917)

Co-authored-by: petersssong <petersssong@proton.me>
Co-authored-by: aljo242 <alex@interchainlabs.io>
This commit is contained in:
mergify[bot] 2025-03-06 13:32:20 -05:00 committed by GitHub
parent 2076e2fc86
commit 1cf0c517a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,11 +36,7 @@ func (dni *doNothingIterator) IterateGenesisBalances(_ codec.JSONCodec, _ map[st
// Ensures that CollectTx correctly traverses directories and won't error out on encountering
// a directory during traversal of the first level. See issue https://github.com/cosmos/cosmos-sdk/issues/6788.
func TestCollectTxsHandlesDirectories(t *testing.T) {
testDir, err := os.MkdirTemp(os.TempDir(), "testCollectTxs")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(testDir)
testDir := t.TempDir()
// 1. We'll insert a directory as the first element before JSON file.
subDirPath := filepath.Join(testDir, "_adir")