Add dummy CLUSTER SLAVES call tests to fix reply ci (#12224)

In #12166, we removed a call to CLUSTER SLAVES, which
then caused reply-schemas ci to fail:
```
WARNING! The following commands were not hit at all:
  cluster|slaves
  ERROR! at least one command was not hit by the tests
```

Because we already have command output that cover CLUSTER REPLICAS
elsewhere, here we simply add some dummy tests to fix the ci.
This commit is contained in:
Binbin 2023-05-24 14:28:38 +08:00 committed by GitHub
parent 4c74dd986f
commit ec5721d6ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -82,3 +82,8 @@ test "Coverage: CLUSTER HELP" {
test "Coverage: ASKING" {
assert_equal {OK} [R 0 ASKING]
}
test "CLUSTER SLAVES and CLUSTER REPLICAS with zero replicas" {
assert_equal {} [R 0 cluster slaves [R 0 CLUSTER MYID]]
assert_equal {} [R 0 cluster replicas [R 0 CLUSTER MYID]]
}

View File

@ -16,11 +16,20 @@ test "Cluster is up" {
test "The first master has actually two slaves" {
wait_for_condition 1000 50 {
[llength [lindex [R 0 role] 2]] == 2
&& [llength [R 0 cluster replicas [R 0 CLUSTER MYID]]] == 2
} else {
fail "replicas didn't connect"
}
}
test "CLUSTER SLAVES and CLUSTER REPLICAS output is consistent" {
# Because we already have command output that cover CLUSTER REPLICAS elsewhere,
# here we simply judge whether their output is consistent to cover CLUSTER SLAVES.
set res [R 0 cluster slaves [R 0 CLUSTER MYID]]
set res2 [R 0 cluster replicas [R 0 CLUSTER MYID]]
assert_equal $res $res2
}
test {Slaves of #0 are instance #5 and #10 as expected} {
set port0 [get_instance_attrib redis 0 port]
assert {[lindex [R 5 role] 2] == $port0}