fix: avoid using the disk in datastore tests

Makes the timing much less problematic, especially in CI.
This commit is contained in:
Steven Allen 2021-07-20 17:18:43 -07:00
parent 59822c4eb1
commit d5e4862e0f

View File

@ -102,17 +102,13 @@ func badgerStore(tb testing.TB) (ds.Batching, func()) {
}
func leveldbStore(tb testing.TB) (ds.Batching, func()) {
dataPath, err := ioutil.TempDir(os.TempDir(), "leveldb")
if err != nil {
tb.Fatal(err)
}
store, err := leveldb.NewDatastore(dataPath, nil)
// Intentionally test in-memory because disks suck, especially in CI.
store, err := leveldb.NewDatastore("", nil)
if err != nil {
tb.Fatal(err)
}
closer := func() {
store.Close()
os.RemoveAll(dataPath)
}
return store, closer
}