feat: add a redis abstraction to support different versions of the redis sdk (#549)

This commit is contained in:
Ryo
2025-08-05 16:09:54 +08:00
committed by GitHub
parent d4d0ba6b9a
commit ab0ce50df5
11 changed files with 316 additions and 31 deletions

View File

@@ -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()