tor: use T.TempDir to create temporary test directory

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun 2022-08-15 21:08:22 +08:00
parent b5a626be78
commit ca1cc68b79
No known key found for this signature in database
GPG Key ID: DAEBBD2E34C111E6

View File

@ -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.