chore: redislock use stringx.randn replace randomStr func (#1220)

This commit is contained in:
an
2021-11-10 21:14:21 +08:00
committed by GitHub
parent d3bfa16813
commit 3a510a9138
2 changed files with 5 additions and 11 deletions

View File

@@ -3,6 +3,7 @@ package redis
import (
"crypto/tls"
"errors"
"github.com/tal-tech/go-zero/core/stringx"
"io"
"strconv"
"testing"
@@ -186,7 +187,7 @@ func TestRedis_Hscan(t *testing.T) {
key := "hash:test"
fieldsAndValues := make(map[string]string)
for i := 0; i < 1550; i++ {
fieldsAndValues["filed_"+strconv.Itoa(i)] = randomStr(i)
fieldsAndValues["filed_"+strconv.Itoa(i)] = stringx.Randn(i)
}
err := client.Hmset(key, fieldsAndValues)
assert.Nil(t, err)
@@ -550,7 +551,7 @@ func TestRedis_Sscan(t *testing.T) {
key := "list"
var list []string
for i := 0; i < 1550; i++ {
list = append(list, randomStr(i))
list = append(list, stringx.Randn(i))
}
lens, err := client.Sadd(key, list)
assert.Nil(t, err)