diff options
author | antirez <antirez@gmail.com> | 2015-12-17 17:52:11 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2015-12-17 17:52:11 +0100 |
commit | 9b4dd92c3bc881dc7b77ab4f95f1ba4bdb6fbaa2 (patch) | |
tree | 9cade9b89fcfd3c7d05befbf3530e9ac90554845 /tests/cluster | |
parent | bb215375967cea35a1562feedbce97cf0222f811 (diff) | |
download | redis-9b4dd92c3bc881dc7b77ab4f95f1ba4bdb6fbaa2.tar.gz |
Cluster: resharding test now checks AOF consistency.
It's a key invariant that when AOF is enabled, after the cluster
reshards, a crash-recovery event causes all the keys to be still fine
with the expected logical content. Now this is part of unit 04.
Diffstat (limited to 'tests/cluster')
-rw-r--r-- | tests/cluster/tests/04-resharding.tcl | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/cluster/tests/04-resharding.tcl b/tests/cluster/tests/04-resharding.tcl index 8811762c6..a719a0bf3 100644 --- a/tests/cluster/tests/04-resharding.tcl +++ b/tests/cluster/tests/04-resharding.tcl @@ -13,6 +13,24 @@ test "Cluster is up" { assert_cluster_state ok } +test "Enable AOF in all the instances" { + foreach_redis_id id { + R $id config set appendonly yes + # We use "appendfsync no" because it's fast but also guarantees that + # write(2) is performed before replying to client. + R $id config set appendfsync no + } + + foreach_redis_id id { + wait_for_condition 1000 500 { + [RI $id aof_rewrite_in_progress] == 0 && + [RI $id aof_enabled] == 1 + } else { + fail "Failed to enable AOF on instance #$id" + } + } +} + # Return nno-zero if the specified PID is about a process still in execution, # otherwise 0 is returned. proc process_is_running {pid} { @@ -100,3 +118,27 @@ test "Verify $numkeys keys for consistency with logical content" { assert {[$cluster lrange $key 0 -1] eq $value} } } + +test "Crash and restart all the instances" { + foreach_redis_id id { + kill_instance redis $id + restart_instance redis $id + } +} + +test "Cluster should eventually be up again" { + assert_cluster_state ok +} + +test "Verify $numkeys keys after the crash & restart" { + # Check that the Redis Cluster content matches our logical content. + foreach {key value} [array get content] { + assert {[$cluster lrange $key 0 -1] eq $value} + } +} + +test "Disable AOF in all the instances" { + foreach_redis_id id { + R $id config set appendonly no + } +} |