Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
2c556223
Commit
2c556223
authored
Apr 29, 2014
by
antirez
Browse files
Cluster test: auto-discovery to form full mesh.
parent
2555b2f4
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/cluster/tests/00-base.tcl
View file @
2c556223
...
@@ -28,3 +28,25 @@ test "Different nodes have different IDs" {
...
@@ -28,3 +28,25 @@ test "Different nodes have different IDs" {
set numids
[
llength
[
lsort -unique $ids
]]
set numids
[
llength
[
lsort -unique $ids
]]
assert
{
$numids
== $numnodes
}
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."
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment