2019-07-10 15:10:45 +00:00
|
|
|
package repo
|
|
|
|
|
|
|
|
import "io/ioutil"
|
|
|
|
import "os"
|
|
|
|
import "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)
|
|
|
|
}
|
|
|
|
return repo, func() {
|
2019-07-10 15:14:29 +00:00
|
|
|
_ = os.RemoveAll(path)
|
2019-07-10 15:10:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestFsBasic(t *testing.T) {
|
|
|
|
repo, closer := genFsRepo(t)
|
|
|
|
defer closer()
|
|
|
|
basicTest(t, repo)
|
|
|
|
}
|