fix tests

This commit is contained in:
vyzo 2021-02-28 10:35:27 +02:00
parent f5ce7957f3
commit 88849201ff
2 changed files with 19 additions and 15 deletions

View File

@ -9,14 +9,18 @@ import (
) )
func TestLMDBLiveSet(t *testing.T) { func TestLMDBLiveSet(t *testing.T) {
testLiveSet(t, true) testLiveSet(t, "lmdb")
} }
func TestBoltLiveSet(t *testing.T) { func TestBoltLiveSet(t *testing.T) {
testLiveSet(t, false) testLiveSet(t, "bolt")
} }
func testLiveSet(t *testing.T, useLMDB bool) { func TestBloomLiveSet(t *testing.T) {
testLiveSet(t, "bloom")
}
func testLiveSet(t *testing.T, lsType string) {
t.Helper() t.Helper()
path := "/tmp/liveset-test" path := "/tmp/liveset-test"
@ -26,7 +30,7 @@ func testLiveSet(t *testing.T, useLMDB bool) {
t.Fatal(err) t.Fatal(err)
} }
env, err := NewLiveSetEnv(path, useLMDB) env, err := NewLiveSetEnv(path, lsType)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -10,7 +10,15 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
) )
func testTrackingStore(t *testing.T, useLMDB bool) { func TestLMDBTrackingStore(t *testing.T) {
testTrackingStore(t, "lmdb")
}
func TestBoltTrackingStore(t *testing.T) {
testTrackingStore(t, "bolt")
}
func testTrackingStore(t *testing.T, tsType string) {
t.Helper() t.Helper()
makeCid := func(key string) cid.Cid { makeCid := func(key string) cid.Cid {
@ -47,7 +55,7 @@ func testTrackingStore(t *testing.T, useLMDB bool) {
t.Fatal(err) t.Fatal(err)
} }
s, err := NewTrackingStore(path, useLMDB) s, err := NewTrackingStore(path, tsType)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -114,7 +122,7 @@ func testTrackingStore(t *testing.T, useLMDB bool) {
t.Fatal(err) t.Fatal(err)
} }
s, err = NewTrackingStore(path, useLMDB) s, err = NewTrackingStore(path, tsType)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -126,11 +134,3 @@ func testTrackingStore(t *testing.T, useLMDB bool) {
s.Close() //nolint:errcheck s.Close() //nolint:errcheck
} }
func TestLMDBTrackingStore(t *testing.T) {
testTrackingStore(t, true)
}
func TestBoltTrackingStore(t *testing.T) {
testTrackingStore(t, false)
}