lotus/node/repo/fsrepo_test.go

38 lines
568 B
Go
Raw Normal View History

2021-11-01 00:24:26 +00:00
//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)
}
2021-11-01 00:24:26 +00:00
//stm: @REPO_FS_001
repo, err := NewFS(path)
if err != nil {
t.Fatal(err)
}
2021-11-01 00:24:26 +00:00
//stm: @REPO_FS_002
2019-11-12 17:59:38 +00:00
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()
2021-11-01 00:24:26 +00:00
//stm: @REPO_FS_003
basicTest(t, repo)
}