lotus/node/repo/fsrepo_test.go
Eng Zer Jun c229842f57
test: use T.TempDir to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-03-15 00:21:31 +08:00

27 lines
352 B
Go

//stm: #unit
package repo
import (
"testing"
)
func genFsRepo(t *testing.T) *FsRepo {
path := t.TempDir()
repo, err := NewFS(path)
if err != nil {
t.Fatal(err)
}
err = repo.Init(FullNode)
if err != ErrRepoExists && err != nil {
t.Fatal(err)
}
return repo
}
func TestFsBasic(t *testing.T) {
repo := genFsRepo(t)
basicTest(t, repo)
}