summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-04-29 15:39:54 +0200
committerantirez <antirez@gmail.com>2014-05-05 09:37:39 +0200
commit6e60e2467bcfbc91efbac787129b2a77dd74a0f1 (patch)
treec39582773540433ba5a5cb73484e8d421690b2d9
parentb1f6f2ace02e9405474f40065e242af455187c6d (diff)
downloadredis-6e60e2467bcfbc91efbac787129b2a77dd74a0f1.tar.gz
Cluster test: config epoch conflict resolution.
-rw-r--r--tests/cluster/tests/00-base.tcl24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/cluster/tests/00-base.tcl b/tests/cluster/tests/00-base.tcl
index ba8682598..6eb81f897 100644
--- a/tests/cluster/tests/00-base.tcl
+++ b/tests/cluster/tests/00-base.tcl
@@ -50,3 +50,27 @@ test "Check if nodes auto-discovery works" {
}
}
}
+
+test "After the join, every node gets a different config epoch" {
+ set trynum 60
+ while {[incr trynum -1] != 0} {
+ # We check that this condition is true for *all* the nodes.
+ set ok 1 ; # Will be set to 0 every time a node is not ok.
+ foreach_redis_id id {
+ set epochs {}
+ foreach n [get_cluster_nodes $id] {
+ lappend epochs [dict get $n config_epoch]
+ }
+ if {[lsort $epochs] != [lsort -unique $epochs]} {
+ set ok 0 ; # At least one collision!
+ }
+ }
+ if {$ok} break
+ after 1000
+ puts -nonewline .
+ flush stdout
+ }
+ if {$trynum == 0} {
+ fail "Config epoch conflict resolution is not working."
+ }
+}