diff --git a/core/stores/redis/redis_test.go b/core/stores/redis/redis_test.go index e084cf42..85589130 100644 --- a/core/stores/redis/redis_test.go +++ b/core/stores/redis/redis_test.go @@ -42,6 +42,13 @@ func TestRedis_Eval(t *testing.T) { }) } +func TestRedis_GeoHash(t *testing.T) { + runOnRedis(t, func(client *Redis) { + _, err := client.GeoHash("parent", "child1", "child2") + assert.NotNil(t, err) + }) +} + func TestRedis_Hgetall(t *testing.T) { runOnRedis(t, func(client *Redis) { assert.Nil(t, client.Hset("a", "aa", "aaa")) @@ -164,7 +171,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)] = randomStr(i) } err := client.Hmset(key, fieldsAndValues) assert.Nil(t, err) diff --git a/core/stores/redis/redisblockingnode_test.go b/core/stores/redis/redisblockingnode_test.go new file mode 100644 index 00000000..b64a887b --- /dev/null +++ b/core/stores/redis/redisblockingnode_test.go @@ -0,0 +1,19 @@ +package redis + +import ( + "testing" + + "github.com/alicebob/miniredis/v2" + "github.com/stretchr/testify/assert" +) + +func TestBlockingNode(t *testing.T) { + r, err := miniredis.Run() + assert.Nil(t, err) + node, err := CreateBlockingNode(NewRedis(r.Addr(), NodeType)) + assert.Nil(t, err) + node.Close() + node, err = CreateBlockingNode(NewRedis(r.Addr(), ClusterType)) + assert.Nil(t, err) + node.Close() +} diff --git a/core/stores/redis/scriptcache_test.go b/core/stores/redis/scriptcache_test.go new file mode 100644 index 00000000..22f6051a --- /dev/null +++ b/core/stores/redis/scriptcache_test.go @@ -0,0 +1,16 @@ +package redis + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestScriptCache(t *testing.T) { + cache := GetScriptCache() + cache.SetSha("foo", "bar") + cache.SetSha("bla", "blabla") + bar, ok := cache.GetSha("foo") + assert.True(t, ok) + assert.Equal(t, "bar", bar) +}