From ca1cc68b7904630ace9a47a4b256421a8f03f851 Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Mon, 15 Aug 2022 21:08:22 +0800 Subject: [PATCH] tor: use `T.TempDir` to create temporary test directory Signed-off-by: Eng Zer Jun --- tor/cmd_onion_test.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tor/cmd_onion_test.go b/tor/cmd_onion_test.go index f6b2c4b17..bef548a75 100644 --- a/tor/cmd_onion_test.go +++ b/tor/cmd_onion_test.go @@ -3,7 +3,6 @@ package tor import ( "bytes" "errors" - "io/ioutil" "path/filepath" "testing" @@ -16,11 +15,8 @@ import ( func TestOnionFile(t *testing.T) { t.Parallel() - tempDir, err := ioutil.TempDir("", "onion_store") - require.NoError(t, err, "unable to create temp dir") - privateKey := []byte("hide_me_plz") - privateKeyPath := filepath.Join(tempDir, "secret") + privateKeyPath := filepath.Join(t.TempDir(), "secret") // Create a new file-based onion store. A private key should not exist // yet.