镜像自地址
https://github.com/tuna/tunasync.git
已同步 2025-12-06 06:26:46 +00:00
Add badger to db backend
这个提交包含在:
@@ -162,7 +162,7 @@ func DBAdapterTest(db dbAdapter) {
|
||||
return
|
||||
}
|
||||
|
||||
func TestBoltAdapter(t *testing.T) {
|
||||
func TestDBAdapter(t *testing.T) {
|
||||
Convey("boltAdapter should work", t, func() {
|
||||
tmpDir, err := ioutil.TempDir("", "tunasync")
|
||||
defer os.RemoveAll(tmpDir)
|
||||
@@ -198,4 +198,22 @@ func TestBoltAdapter(t *testing.T) {
|
||||
|
||||
DBAdapterTest(redisDB)
|
||||
})
|
||||
|
||||
Convey("badgerAdapter should work", t, func() {
|
||||
tmpDir, err := ioutil.TempDir("", "tunasync")
|
||||
defer os.RemoveAll(tmpDir)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
dbType, dbFile := "badger", filepath.Join(tmpDir, "badger.db")
|
||||
badgerDB, err := makeDBAdapter(dbType, dbFile)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
defer func() {
|
||||
// close badgerDB
|
||||
err := badgerDB.Close()
|
||||
So(err, ShouldBeNil)
|
||||
}()
|
||||
|
||||
DBAdapterTest(badgerDB)
|
||||
})
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户