镜像自地址
https://github.com/tuna/tunasync.git
已同步 2025-12-06 14:36:47 +00:00
Add mock test for redis backend
这个提交包含在:
@@ -2,6 +2,7 @@ package manager
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -9,6 +10,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/alicebob/miniredis"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
. "github.com/tuna/tunasync/internal"
|
||||
)
|
||||
@@ -178,4 +180,22 @@ func TestBoltAdapter(t *testing.T) {
|
||||
|
||||
DBAdapterTest(boltDB)
|
||||
})
|
||||
|
||||
Convey("redisAdapter should work", t, func() {
|
||||
mr, err := miniredis.Run()
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
addr := fmt.Sprintf("redis://%s", mr.Addr())
|
||||
redisDB, err := makeDBAdapter("redis", addr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
defer func() {
|
||||
// close redisDB
|
||||
err := redisDB.Close()
|
||||
So(err, ShouldBeNil)
|
||||
mr.Close()
|
||||
}()
|
||||
|
||||
DBAdapterTest(redisDB)
|
||||
})
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户