@@ -10,7 +10,6 @@ import (
|
||||
"encoding/binary"
|
||||
"testing"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/db/backend"
|
||||
"github.com/syncthing/syncthing/lib/protocol"
|
||||
)
|
||||
|
||||
@@ -36,10 +35,9 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func setup() (*Lowlevel, *BlockFinder) {
|
||||
// Setup
|
||||
|
||||
db := NewLowlevel(backend.OpenMemory())
|
||||
func setup(t testing.TB) (*Lowlevel, *BlockFinder) {
|
||||
t.Helper()
|
||||
db := newLowlevelMemory(t)
|
||||
return db, NewBlockFinder(db)
|
||||
}
|
||||
|
||||
@@ -105,7 +103,7 @@ func discardFromBlockMap(db *Lowlevel, folder []byte, fs []protocol.FileInfo) er
|
||||
}
|
||||
|
||||
func TestBlockMapAddUpdateWipe(t *testing.T) {
|
||||
db, f := setup()
|
||||
db, f := setup(t)
|
||||
defer db.Close()
|
||||
|
||||
if !dbEmpty(db) {
|
||||
@@ -193,7 +191,7 @@ func TestBlockMapAddUpdateWipe(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestBlockFinderLookup(t *testing.T) {
|
||||
db, f := setup()
|
||||
db, f := setup(t)
|
||||
defer db.Close()
|
||||
|
||||
folder1 := []byte("folder1")
|
||||
|
||||
Reference in New Issue
Block a user