feat: add a redis abstraction to support different versions of the redis sdk (#549)
This commit is contained in:
@@ -438,7 +438,7 @@ func PruneIsolatedNodes(nodes []*vo.Node, edges []*vo.Edge, parentNode *vo.Node)
|
||||
|
||||
func parseBatchMode(n *vo.Node) (
|
||||
batchN *vo.Node, // the new batch node
|
||||
enabled bool, // whether the node has enabled batch mode
|
||||
enabled bool, // whether the node has enabled batch mode
|
||||
err error) {
|
||||
if n.Data == nil || n.Data.Inputs == nil {
|
||||
return nil, false, nil
|
||||
|
||||
@@ -31,7 +31,6 @@ import (
|
||||
model2 "github.com/cloudwego/eino/components/model"
|
||||
"github.com/cloudwego/eino/compose"
|
||||
"github.com/cloudwego/eino/schema"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
"gorm.io/driver/mysql"
|
||||
@@ -47,6 +46,7 @@ import (
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/nodes/exit"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/nodes/qa"
|
||||
repo2 "github.com/coze-dev/coze-studio/backend/domain/workflow/internal/repo"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/cache/redis"
|
||||
schema2 "github.com/coze-dev/coze-studio/backend/domain/workflow/internal/schema"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/checkpoint"
|
||||
mock "github.com/coze-dev/coze-studio/backend/internal/mock/infra/contract/idgen"
|
||||
@@ -96,9 +96,7 @@ func TestQuestionAnswer(t *testing.T) {
|
||||
}
|
||||
defer s.Close()
|
||||
|
||||
redisClient := redis.NewClient(&redis.Options{
|
||||
Addr: s.Addr(),
|
||||
})
|
||||
redisClient := redis.NewWithAddrAndPassword(s.Addr(), "")
|
||||
|
||||
mockIDGen := mock.NewMockIDGenerator(ctrl)
|
||||
mockIDGen.EXPECT().GenID(gomock.Any()).Return(time.Now().UnixNano(), nil).AnyTimes()
|
||||
|
||||
@@ -25,7 +25,6 @@ import (
|
||||
|
||||
"github.com/DATA-DOG/go-sqlmock"
|
||||
"github.com/alicebob/miniredis/v2"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"gorm.io/driver/mysql"
|
||||
@@ -33,12 +32,14 @@ import (
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/internal/repo/dal/query"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/cache"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/cache/redis"
|
||||
)
|
||||
|
||||
type ExecuteHistoryStoreSuite struct {
|
||||
suite.Suite
|
||||
db *gorm.DB
|
||||
redis *redis.Client
|
||||
redis cache.Cmdable
|
||||
mock sqlmock.Sqlmock
|
||||
store *executeHistoryStoreImpl
|
||||
}
|
||||
@@ -47,7 +48,7 @@ func (s *ExecuteHistoryStoreSuite) SetupTest() {
|
||||
var err error
|
||||
mr, err := miniredis.Run()
|
||||
assert.NoError(s.T(), err)
|
||||
s.redis = redis.NewClient(&redis.Options{Addr: mr.Addr()})
|
||||
s.redis = redis.NewWithAddrAndPassword(mr.Addr(), "")
|
||||
|
||||
mockDB, mock, err := sqlmock.New()
|
||||
assert.NoError(s.T(), err)
|
||||
|
||||
Reference in New Issue
Block a user