refactor: add cache tests and remove cache merge task (#14)

This commit is contained in:
l3uddz
2021-02-19 19:15:38 +00:00
committed by GitHub
parent 54cfd68810
commit e1945cf714
18 changed files with 537 additions and 61 deletions

24
cache/test.go vendored Normal file
View File

@@ -0,0 +1,24 @@
package cache
import (
"github.com/xujiajun/nutsdb"
"os"
"path/filepath"
"testing"
)
func newDb(t *testing.T, dir string) *nutsdb.DB {
db, err := nutsdb.Open(nutsdb.Options{
Dir: filepath.Join(os.TempDir(), dir),
EntryIdxMode: nutsdb.HintKeyValAndRAMIdxMode,
SegmentSize: 8 * 1024 * 1024,
NodeNum: 1,
RWMode: nutsdb.FileIO,
SyncEnable: true,
StartFileLoadingMode: nutsdb.MMap,
})
if err != nil {
t.Fatalf("newDb(dir: %v) open error: %v", dir, err)
}
return db
}