Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
ddd9fd41
Commit
ddd9fd41
authored
Jul 28, 2014
by
antirez
Browse files
Cluster test: unit 07, replicas migration.
parent
75b92fe7
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/cluster/tests/07-replica-migration.tcl
0 → 100644
View file @
ddd9fd41
# Replica migration test.
# Check that orphaned masters are joined by replicas of masters having
# multiple replicas attached, according to the migration barrier settings.
source
"../tests/includes/init-tests.tcl"
# Create a cluster with 5 master and 10 slaves, so that we have 2
# slaves for each master.
test
"Create a 5 nodes cluster"
{
create_cluster 5 10
}
test
"Cluster is up"
{
assert_cluster_state ok
}
test
"Each master should have two replicas attached"
{
foreach_redis_id id
{
if
{
$id
< 5
}
{
wait_for_condition 1000 50
{
[
llength
[
lindex
[
R 0 role
]
2
]]
== 2
}
else
{
fail
"Master #
$id
does not have 2 slaves as expected"
}
}
}
}
test
"Killing all the slaves of master #0 and #1"
{
kill_instance redis 5
kill_instance redis 10
kill_instance redis 6
kill_instance redis 11
after 4000
}
foreach_redis_id id
{
if
{
$id
< 5
}
{
test
"Master #
$id
should have at least one replica"
{
wait_for_condition 1000 50
{
[
llength
[
lindex
[
R $id role
]
2
]]
>= 1
}
else
{
fail
"Master #
$id
has no replicas"
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment