diff options
author | antirez <antirez@gmail.com> | 2014-07-18 17:13:46 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-07-18 17:13:46 +0200 |
commit | 8d4ff87b26772300e0d584c360edb17763d69a68 (patch) | |
tree | 99e55d51ae56684200d075b7ef52fb3ad1ff1ae6 | |
parent | 509c888dfa59c62648f9d138364615aff12983c9 (diff) | |
download | redis-8d4ff87b26772300e0d584c360edb17763d69a68.tar.gz |
Cluster test: test that writes are retained during failovers.
In the test we use WAIT when the master and slave are up, and only later the
partition is created killing the master, so we are sure we don't incur
in failure modes that may lose writes in this test: the goal here is to
make sure that the elected slave was replicating correctly with the
master.
-rw-r--r-- | tests/cluster/tests/03-failover-loop.tcl | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/cluster/tests/03-failover-loop.tcl b/tests/cluster/tests/03-failover-loop.tcl index 9de258aa7..4106f146d 100644 --- a/tests/cluster/tests/03-failover-loop.tcl +++ b/tests/cluster/tests/03-failover-loop.tcl @@ -49,6 +49,15 @@ while {[incr iterations -1]} { set slave_config_epoch [CI $slave cluster_my_epoch] } + test "Cluster is writable before failover" { + for {set i 0} {$i < 100} {incr i} { + catch {$cluster set $key:$i $val:$i} err + assert {$err eq {OK}} + } + # Wait for the write to propagate to the slave + R $tokill wait 1 20000 + } + test "Killing node #$tokill" { kill_instance redis $tokill } @@ -67,9 +76,9 @@ while {[incr iterations -1]} { assert_cluster_state ok } - test "Cluster is writable" { + test "Cluster is writable again" { for {set i 0} {$i < 100} {incr i} { - catch {$cluster set $key:$i $val:$i} err + catch {$cluster set $key:$i:2 $val:$i:2} err assert {$err eq {OK}} } } @@ -90,6 +99,8 @@ while {[incr iterations -1]} { for {set i 0} {$i < 100} {incr i} { catch {$cluster get $key:$i} err assert {$err eq "$val:$i"} + catch {$cluster get $key:$i:2} err + assert {$err eq "$val:$i:2"} } } } |