19 Star 83 Fork 8

piaohao/godis

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
redis_sentinel_cmd_test.go 2.93 KB
一键复制 编辑 原始数据 按行查看 历史
piaohao 提交于 2019-07-03 18:42 . 1.add more args of poolconfig;
package godis
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestRedis_SentinelFailover(t *testing.T) {
redis := NewRedis(option)
defer redis.Close()
s, err := redis.SentinelFailOver("a")
assert.NotNil(t, err)
assert.Equal(t, "", s)
redisBroken := NewRedis(option)
defer redisBroken.Close()
redisBroken.client.connection.host = "localhost1"
redisBroken.Close()
_, err = redisBroken.SentinelFailOver("a")
assert.NotNil(t, err)
}
func TestRedis_SentinelGetMasterAddrByName(t *testing.T) {
redis := NewRedis(option)
defer redis.Close()
_, err := redis.SentinelGetMasterAddrByName("a")
assert.NotNil(t, err)
redisBroken := NewRedis(option)
defer redisBroken.Close()
redisBroken.client.connection.host = "localhost1"
redisBroken.Close()
_, err = redisBroken.SentinelGetMasterAddrByName("a")
assert.NotNil(t, err)
}
func TestRedis_SentinelMasters(t *testing.T) {
redis := NewRedis(option)
defer redis.Close()
_, err := redis.SentinelMasters()
assert.NotNil(t, err)
redisBroken := NewRedis(option)
defer redisBroken.Close()
redisBroken.client.connection.host = "localhost1"
redisBroken.Close()
_, err = redisBroken.SentinelMasters()
assert.NotNil(t, err)
}
func TestRedis_SentinelMonitor(t *testing.T) {
redis := NewRedis(option)
defer redis.Close()
_, err := redis.SentinelMonitor("a", "", 0, 0)
assert.NotNil(t, err)
redisBroken := NewRedis(option)
defer redisBroken.Close()
redisBroken.client.connection.host = "localhost1"
redisBroken.Close()
_, err = redisBroken.SentinelMonitor("a", "", 0, 0)
assert.NotNil(t, err)
}
func TestRedis_SentinelRemove(t *testing.T) {
redis := NewRedis(option)
defer redis.Close()
_, err := redis.SentinelRemove("a")
assert.NotNil(t, err)
redisBroken := NewRedis(option)
defer redisBroken.Close()
redisBroken.client.connection.host = "localhost1"
redisBroken.Close()
_, err = redisBroken.SentinelRemove("a")
assert.NotNil(t, err)
}
func TestRedis_SentinelReset(t *testing.T) {
redis := NewRedis(option)
defer redis.Close()
_, err := redis.SentinelReset("a")
assert.NotNil(t, err)
redisBroken := NewRedis(option)
defer redisBroken.Close()
redisBroken.client.connection.host = "localhost1"
redisBroken.Close()
_, err = redisBroken.SentinelReset("a")
assert.NotNil(t, err)
}
func TestRedis_SentinelSet(t *testing.T) {
redis := NewRedis(option)
defer redis.Close()
_, err := redis.SentinelSet("a", nil)
assert.NotNil(t, err)
redisBroken := NewRedis(option)
defer redisBroken.Close()
redisBroken.client.connection.host = "localhost1"
redisBroken.Close()
_, err = redisBroken.SentinelSet("a", nil)
assert.NotNil(t, err)
}
func TestRedis_SentinelSlaves(t *testing.T) {
redis := NewRedis(option)
defer redis.Close()
_, err := redis.SentinelSlaves("a")
assert.NotNil(t, err)
redisBroken := NewRedis(option)
defer redisBroken.Close()
redisBroken.client.connection.host = "localhost1"
redisBroken.Close()
_, err = redisBroken.SentinelSlaves("a")
assert.NotNil(t, err)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/piaohao/godis.git
[email protected]:piaohao/godis.git
piaohao
godis
godis
master

搜索帮助