Adding missing test cases for Addslot Command (#12288)

Added missing test case coverage for below scenarios:

1. The command only works if all the specified slots are, from
  the point of view of the node receiving the command, currently
  not assigned. A node will refuse to take ownership for slots that
  already belong to some other node (including itself).
2. The command fails if the same slot is specified multiple times.
This commit is contained in:
Wen Hui 2023-06-11 13:36:26 +08:00 committed by GitHub
parent 5fd9756d2e
commit d412269ff8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,6 +48,17 @@ test "Continuous slots distribution" {
assert_match "*13105 13500*14001 15000*16001 16383*" [$master5 CLUSTER SLOTS]
}
test "ADDSLOTS command with several boundary conditions test suite" {
assert_error "ERR Invalid or out of range slot" {R 0 cluster ADDSLOTS 3001 aaa}
assert_error "ERR Invalid or out of range slot" {R 0 cluster ADDSLOTS 3001 -1000}
assert_error "ERR Invalid or out of range slot" {R 0 cluster ADDSLOTS 3001 30003}
assert_error "ERR Slot 3200 is already busy" {R 0 cluster ADDSLOTS 3200}
assert_error "ERR Slot 8501 is already busy" {R 0 cluster ADDSLOTS 8501}
assert_error "ERR Slot 3001 specified multiple times" {R 0 cluster ADDSLOTS 3001 3002 3001}
}
test "ADDSLOTSRANGE command with several boundary conditions test suite" {
# Add multiple slots with incorrect argument number
assert_error "ERR wrong number of arguments for 'cluster|addslotsrange' command" {R 0 cluster ADDSLOTSRANGE 3001 3020 3030}