summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-12-17 17:52:11 +0100
committerantirez <antirez@gmail.com>2015-12-17 17:53:29 +0100
commitcd29e7be277da5ead8c885913b196c193231d23a (patch)
tree37948271116855da5e3a540e51f5a3139c68a9b9
parent7a7e46b22f76a8fd20a733cae6de0e0cb445c08b (diff)
downloadredis-cd29e7be277da5ead8c885913b196c193231d23a.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.
-rw-r--r--tests/cluster/tests/04-resharding.tcl42
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
+ }
+}