Skip to content

Commit 2c55622

Browse files
committed
Cluster test: auto-discovery to form full mesh.
1 parent 2555b2f commit 2c55622

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/cluster/tests/00-base.tcl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,25 @@ test "Different nodes have different IDs" {
2828
set numids [llength [lsort -unique $ids]]
2929
assert {$numids == $numnodes}
3030
}
31+
32+
test "Check if nodes auto-discovery works" {
33+
# Join node 0 with 1, 1 with 2, ... and so forth.
34+
# If auto-discovery works all nodes will know every other node
35+
# eventually.
36+
set ids {}
37+
foreach_redis_id id {lappend ids $id}
38+
for {set j 0} {$j < [expr [llength $ids]-1]} {incr j} {
39+
set a [lindex $ids $j]
40+
set b [lindex $ids [expr $j+1]]
41+
set b_port [get_instance_attrib redis $b port]
42+
R $a cluster meet 127.0.0.1 $b_port
43+
}
44+
45+
foreach_redis_id id {
46+
wait_for_condition 1000 50 {
47+
[llength [get_cluster_nodes $id]] == [llength $ids]
48+
} else {
49+
fail "Cluster failed to join into a full mesh."
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)