lotus/node/repo/fsrepo_test.go
2021-12-20 17:00:01 +01:00

35 lines
505 B
Go

//stm: #unit
package repo
import (
"io/ioutil"
"os"
"testing"
)
func genFsRepo(t *testing.T) (*FsRepo, func()) {
path, err := ioutil.TempDir("", "lotus-repo-")
if err != nil {
t.Fatal(err)
}
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() {
_ = os.RemoveAll(path)
}
}
func TestFsBasic(t *testing.T) {
repo, closer := genFsRepo(t)
defer closer()
basicTest(t, repo)
}