Skip to content

Commit

Permalink
Add missing test helper function
Browse files Browse the repository at this point in the history
Signed-off-by: Ping Xie <[email protected]>
  • Loading branch information
PingXie committed Jul 10, 2024
1 parent 010609e commit ad0a24c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/support/cluster_util.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,16 @@ proc check_cluster_node_mark {flag ref_node_index instance_id_to_check} {
}
fail "Unable to find instance id in cluster nodes. ID: $instance_id_to_check"
}

proc cluster_allocate_slots {masters replicas} {
set slot 16383
while {$slot >= 0} {
# Allocate successive slots to random nodes.
set node [randomInt $masters]
lappend slots_$node $slot
incr slot -1
}
for {set j 0} {$j < $masters} {incr j} {
R $j cluster addslots {*}[set slots_${j}]
}
}

0 comments on commit ad0a24c

Please sign in to comment.