From cd29e7be277da5ead8c885913b196c193231d23a Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 17 Dec 2015 17:52:11 +0100 Subject: 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. --- tests/cluster/tests/04-resharding.tcl | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) 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 + } +} -- cgit v1.2.1