diff options
author | antirez <antirez@gmail.com> | 2014-04-29 15:00:11 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-04-29 15:00:11 +0200 |
commit | 2c556223330e656404bbce82db61daec604e7015 (patch) | |
tree | c9cc5efdec064abaec66460245fd8f67be232e67 | |
parent | 2555b2f4bd0499fe16f50d004d3596132e8a33ba (diff) | |
download | redis-2c556223330e656404bbce82db61daec604e7015.tar.gz |
Cluster test: auto-discovery to form full mesh.
-rw-r--r-- | tests/cluster/tests/00-base.tcl | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/cluster/tests/00-base.tcl b/tests/cluster/tests/00-base.tcl index cf2a7644d..ba8682598 100644 --- a/tests/cluster/tests/00-base.tcl +++ b/tests/cluster/tests/00-base.tcl @@ -28,3 +28,25 @@ test "Different nodes have different IDs" { set numids [llength [lsort -unique $ids]] assert {$numids == $numnodes} } + +test "Check if nodes auto-discovery works" { + # Join node 0 with 1, 1 with 2, ... and so forth. + # If auto-discovery works all nodes will know every other node + # eventually. + set ids {} + foreach_redis_id id {lappend ids $id} + for {set j 0} {$j < [expr [llength $ids]-1]} {incr j} { + set a [lindex $ids $j] + set b [lindex $ids [expr $j+1]] + set b_port [get_instance_attrib redis $b port] + R $a cluster meet 127.0.0.1 $b_port + } + + foreach_redis_id id { + wait_for_condition 1000 50 { + [llength [get_cluster_nodes $id]] == [llength $ids] + } else { + fail "Cluster failed to join into a full mesh." + } + } +} |