代码拉取完成,页面将自动刷新
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)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。