Use the T.TempDir and B.TempDir to create temp dirs for testing (#10560)

* Use t.TempDir and b.TempDir for temporary test dirs

* Remove redundant dir cleanup
This commit is contained in:
Håvard Anda Estensen
2022-04-21 22:45:44 +02:00
committed by GitHub
parent 21fc9853ee
commit 2fd7c926ed
9 changed files with 10 additions and 62 deletions

View File

@@ -5,7 +5,6 @@ import (
"context"
"encoding/hex"
"fmt"
"os"
"path/filepath"
"strings"
"testing"
@@ -55,10 +54,7 @@ func Test_generateKeysFromMnemonicList(t *testing.T) {
func Test_spreadKeysAcrossImportedWallets(t *testing.T) {
walletPassword := "Sr0ngPass0q0z929301"
tmpDir := filepath.Join(os.TempDir(), "testwallets")
t.Cleanup(func() {
require.NoError(t, os.RemoveAll(tmpDir))
})
tmpDir := filepath.Join(t.TempDir(), "testwallets")
// Spread 5 keys across 5 wallets, meaning there is 1
// key per wallet stored on disk.