Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xindoo
redis
提交
8d92885b
R
redis
项目概览
xindoo
/
redis
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
8d92885b
编写于
3月 14, 2018
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cluster: add test for the nofailover flag.
上级
70597a30
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
71 addition
and
0 deletion
+71
-0
tests/cluster/cluster.tcl
tests/cluster/cluster.tcl
+10
-0
tests/cluster/tests/13-no-failover-option.tcl
tests/cluster/tests/13-no-failover-option.tcl
+61
-0
未找到文件。
tests/cluster/cluster.tcl
浏览文件 @
8d92885b
...
...
@@ -42,6 +42,16 @@ proc get_myself id {
return
{}
}
# Get a specific node by ID by parsing the CLUSTER NODES output
# of the instance Number 'instance_id'
proc get_node_by_id
{
instance_id node_id
}
{
set nodes
[
get_cluster_nodes $instance_id
]
foreach n $nodes
{
if
{[
dict get $n id
]
eq $node_id
}
{
return $n
}
}
return
{}
}
# Return the value of the specified CLUSTER INFO field.
proc CI
{
n field
}
{
get_info_field
[
R $n cluster info
]
$field
...
...
tests/cluster/tests/13-no-failover-option.tcl
0 → 100644
浏览文件 @
8d92885b
# Check that the no-failover option works
source
"../tests/includes/init-tests.tcl"
test
"Create a 5 nodes cluster"
{
create_cluster 5 5
}
test
"Cluster is up"
{
assert_cluster_state ok
}
test
"Cluster is writable"
{
cluster_write_test 0
}
test
"Instance #5 is a slave"
{
assert
{[
RI 5 role
]
eq
{
slave
}}
# Configure it to never failover the master
R 5 CONFIG SET cluster-slave-no-failover yes
}
test
"Instance #5 synced with the master"
{
wait_for_condition 1000 50
{
[
RI 5 master_link_status
]
eq
{
up
}
}
else
{
fail
"Instance #5 master link status is not up"
}
}
test
"The nofailover flag is propagated"
{
set slave5_id
[
dict get
[
get_myself 5
]
id
]
foreach_redis_id id
{
wait_for_condition 1000 50
{
[
has_flag
[
get_node_by_id $id $slave5_id
]
nofailover
]
}
else
{
fail
"Instance
$id
can't see the nofailover flag of slave"
}
}
}
set current_epoch
[
CI 1 cluster_current_epoch
]
test
"Killing one master node"
{
kill_instance redis 0
}
test
"Cluster should be still down after some time"
{
after 10000
assert_cluster_state fail
}
test
"Instance #5 is still a slave"
{
assert
{[
RI 5 role
]
eq
{
slave
}}
}
test
"Restarting the previously killed master node"
{
restart_instance redis 0
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录