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
f03f1fad
Commit
f03f1fad
authored
Apr 21, 2020
by
yanhui13
Committed by
antirez
Apr 24, 2020
Browse files
add tcl test for cluster slots
parent
374ffdf1
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/cluster/tests/15-cluster-slots.tcl
0 → 100644
View file @
f03f1fad
source
"../tests/includes/init-tests.tcl"
proc cluster_allocate_mixedSlots
{
n
}
{
set slot 16383
while
{
$slot
>= 0
}
{
set node
[
expr
{
$slot
% $n
}]
lappend slots_$node $slot
incr slot -1
}
for
{
set j 0
}
{
$j
< $n
}
{
incr j
}
{
R $j cluster addslots
{*}
[
set slots_$
{
j
}]
}
}
proc create_cluster_with_mixedSlot
{
masters slaves
}
{
cluster_allocate_mixedSlots $masters
if
{
$slaves
}
{
cluster_allocate_slaves $masters $slaves
}
assert_cluster_state ok
}
test
"Create a 5 nodes cluster"
{
create_cluster_with_mixedSlot 5 15
}
test
"Cluster is up"
{
assert_cluster_state ok
}
test
"Cluster is writable"
{
cluster_write_test 0
}
test
"Instance #5 is a slave"
{
assert
{[
RI 5 role
]
eq
{
slave
}}
}
test
"client do not break when cluster slot"
{
R 0 config set client-output-buffer-limit
"normal 33554432 16777216 60"
if
{
[
catch
{
R 0 cluster slots
}]
}
{
fail
"output overflow when cluster slots"
}
}
\ No newline at end of file
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