channeldb: 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 committed 2022-08-24 08:58:16 +08:00
1 parent 519df2a15d
commit dd07cb850d
9 files changed
+79 -166

No files matched your search

+1 -7
View File
@@ -2,8 +2,6 @@ package channeldb
import (
"bytes"
"io/ioutil"
"os"
"testing"
"github.com/go-errors/errors"
@@ -422,11 +420,7 @@ func TestMigrationWithoutErrors(t *testing.T) {
func TestMigrationReversion(t *testing.T) {
t.Parallel()
tempDirName, err := ioutil.TempDir("", "channeldb")
defer func() {
os.RemoveAll(tempDirName)
}()
require.NoError(t, err, "unable to create temp dir")
tempDirName := t.TempDir()
backend, cleanup, err := kvdb.GetTestBackend(tempDirName, "cdb")
require.NoError(t, err, "unable to get test db backend")