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
7665cc67
Commit
7665cc67
authored
Jun 19, 2014
by
antirez
Browse files
Sentinel test: add manual failover test.
parent
1267e28e
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/sentinel/tests/05-manual.tcl
0 → 100644
View file @
7665cc67
# Test manual failover
source
"../tests/includes/init-tests.tcl"
test
"Manual failover works"
{
set old_port
[
RI $master_id tcp_port
]
set addr
[
S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster
]
assert
{[
lindex $addr 1
]
== $old_port
}
S 0 SENTINEL FAILOVER mymaster
foreach_sentinel_id id
{
wait_for_condition 1000 50
{
[
lindex
[
S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster
]
1
]
!= $old_port
}
else
{
fail
"At least one Sentinel did not received failover info"
}
}
set addr
[
S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster
]
set master_id
[
get_instance_id_by_port redis
[
lindex $addr 1
]]
}
test
"New master
[
join $addr
{
:
}]
role matches"
{
assert
{[
RI $master_id role
]
eq
{
master
}}
}
test
"All the other slaves now point to the new master"
{
foreach_redis_id id
{
if
{
$id
!= $master_id && $id != 0
}
{
wait_for_condition 1000 50
{
[
RI $id master_port
]
==
[
lindex $addr 1
]
}
else
{
fail
"Redis ID
$id
not configured to replicate with new master"
}
}
}
}
test
"The old master eventually gets reconfigured as a slave"
{
wait_for_condition 1000 50
{
[
RI 0 master_port
]
==
[
lindex $addr 1
]
}
else
{
fail
"Old master not reconfigured as slave of new master"
}
}
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