Binbin fdd023ff82
Migrate cluster mode tests to normal framework (#442)
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>
2024-05-09 10:14:47 +08:00

44 lines
1.2 KiB
Tcl

# Check cluster info stats
start_cluster 2 0 {tags {external:skip cluster}} {
test "Cluster should start ok" {
wait_for_cluster_state ok
}
set primary1 [srv 0 "client"]
set primary2 [srv -1 "client"]
proc cmdstat {instance cmd} {
return [cmdrstat $cmd $instance]
}
proc errorstat {instance cmd} {
return [errorrstat $cmd $instance]
}
test "errorstats: rejected call due to MOVED Redirection" {
$primary1 config resetstat
$primary2 config resetstat
assert_match {} [errorstat $primary1 MOVED]
assert_match {} [errorstat $primary2 MOVED]
# we know that one will have a MOVED reply and one will succeed
catch {$primary1 set key b} replyP1
catch {$primary2 set key b} replyP2
# sort servers so we know which one failed
if {$replyP1 eq {OK}} {
assert_match {MOVED*} $replyP2
set pok $primary1
set perr $primary2
} else {
assert_match {MOVED*} $replyP1
set pok $primary2
set perr $primary1
}
assert_match {} [errorstat $pok MOVED]
assert_match {*count=1*} [errorstat $perr MOVED]
assert_match {*calls=0,*,rejected_calls=1,failed_calls=0} [cmdstat $perr set]
}
} ;# start_cluster