
We currently has two disjoint TCL frameworks: 1. Normal testing framework, which trigger by runtest, which individually launches nodes for testing. 2. Cluster framework, which trigger by runtest-cluster, which pre-allocates N nodes and uses them for testing large configurations. The normal TCL testing framework is much more readily tested and is also automatically run as part of the CI for new PRs. The runtest-cluster since it runs very slowly (cannot be parallelized), it currently only runs in daily CI, this results in some changes to the cluster not being exposed in PR CI in time. This PR migrate the Cluster mode tests to normal framework. Some cluster tests are kept in runtest-cluster because of timing issues or not yet supported, we can process them later. Signed-off-by: Binbin <binloveplay1314@qq.com>
48 lines
1.8 KiB
Tcl
48 lines
1.8 KiB
Tcl
# Optimize CLUSTER NODES command by generating all nodes slot topology firstly
|
|
|
|
start_cluster 2 2 {tags {external:skip cluster}} {
|
|
|
|
test "Cluster should start ok" {
|
|
wait_for_cluster_state ok
|
|
}
|
|
|
|
set master1 [srv 0 "client"]
|
|
set master2 [srv -1 "client"]
|
|
|
|
test "Continuous slots distribution" {
|
|
assert_match "* 0-8191*" [$master1 CLUSTER NODES]
|
|
assert_match "* 8192-16383*" [$master2 CLUSTER NODES]
|
|
assert_match "*0 8191*" [$master1 CLUSTER SLOTS]
|
|
assert_match "*8192 16383*" [$master2 CLUSTER SLOTS]
|
|
|
|
$master1 CLUSTER DELSLOTS 4096
|
|
assert_match "* 0-4095 4097-8191*" [$master1 CLUSTER NODES]
|
|
assert_match "*0 4095*4097 8191*" [$master1 CLUSTER SLOTS]
|
|
|
|
$master2 CLUSTER DELSLOTS 12288
|
|
assert_match "* 8192-12287 12289-16383*" [$master2 CLUSTER NODES]
|
|
assert_match "*8192 12287*12289 16383*" [$master2 CLUSTER SLOTS]
|
|
}
|
|
|
|
test "Discontinuous slots distribution" {
|
|
# Remove middle slots
|
|
$master1 CLUSTER DELSLOTS 4092 4094
|
|
assert_match "* 0-4091 4093 4095 4097-8191*" [$master1 CLUSTER NODES]
|
|
assert_match "*0 4091*4093 4093*4095 4095*4097 8191*" [$master1 CLUSTER SLOTS]
|
|
$master2 CLUSTER DELSLOTS 12284 12286
|
|
assert_match "* 8192-12283 12285 12287 12289-16383*" [$master2 CLUSTER NODES]
|
|
assert_match "*8192 12283*12285 12285*12287 12287*12289 16383*" [$master2 CLUSTER SLOTS]
|
|
|
|
# Remove head slots
|
|
$master1 CLUSTER DELSLOTS 0 2
|
|
assert_match "* 1 3-4091 4093 4095 4097-8191*" [$master1 CLUSTER NODES]
|
|
assert_match "*1 1*3 4091*4093 4093*4095 4095*4097 8191*" [$master1 CLUSTER SLOTS]
|
|
|
|
# Remove tail slots
|
|
$master2 CLUSTER DELSLOTS 16380 16382 16383
|
|
assert_match "* 8192-12283 12285 12287 12289-16379 16381*" [$master2 CLUSTER NODES]
|
|
assert_match "*8192 12283*12285 12285*12287 12287*12289 16379*16381 16381*" [$master2 CLUSTER SLOTS]
|
|
}
|
|
|
|
} ;# start_cluster
|