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
08c95d6a
Commit
08c95d6a
authored
Sep 15, 2014
by
antirez
Browse files
Cluster test: unit 08, update messages.
parent
60889a36
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/cluster/tests/08-update-msg.tcl
0 → 100644
View file @
08c95d6a
# Test UPDATE messages sent by other nodes when the currently authorirative
# master is unavaialble. The test is performed in the following steps:
#
# 1
)
Master goes down.
# 2
)
Slave failover and becomes new master.
# 3
)
New master is partitoned away.
# 4
)
Old master returns.
# 5
)
At this point we expect the old master to turn into a slave ASAP because
# of the UPDATE messages it will receive from the other nodes when its
# configuration will be found to be outdated.
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
}}
}
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"
}
}
set current_epoch
[
CI 1 cluster_current_epoch
]
test
"Killing one master node"
{
kill_instance redis 0
}
test
"Wait for failover"
{
wait_for_condition 1000 50
{
[
CI 1 cluster_current_epoch
]
> $current_epoch
}
else
{
fail
"No failover detected"
}
}
test
"Cluster should eventually be up again"
{
assert_cluster_state ok
}
test
"Cluster is writable"
{
cluster_write_test 1
}
test
"Instance #5 is now a master"
{
assert
{[
RI 5 role
]
eq
{
master
}}
}
test
"Killing the new master #5"
{
kill_instance redis 5
}
test
"Cluster should be down now"
{
assert_cluster_state fail
}
test
"Restarting the old master node"
{
restart_instance redis 0
}
test
"Instance #0 gets converted into a slave"
{
wait_for_condition 1000 50
{
[
RI 0 role
]
eq
{
slave
}
}
else
{
fail
"Old master was not converted into slave"
}
}
test
"Restarting the new master node"
{
restart_instance redis 5
}
test
"Cluster is up again"
{
assert_cluster_state ok
}
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