mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-03-27 13:30:11 +08:00
fix: avoid using the disk in datastore tests
Makes the timing much less problematic, especially in CI.
This commit is contained in:
parent
59822c4eb1
commit
d5e4862e0f
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user