mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
Test: pipelined MIGRATE tests added.
This commit is contained in:
parent
9ebf7a6776
commit
29d680ed5a
@ -217,4 +217,58 @@ start_server {tags {"dump"}} {
|
|||||||
assert_match {IOERR*} $e
|
assert_match {IOERR*} $e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test {MIGRATE can migrate multiple keys at once} {
|
||||||
|
set first [srv 0 client]
|
||||||
|
r set key1 "v1"
|
||||||
|
r set key2 "v2"
|
||||||
|
r set key3 "v3"
|
||||||
|
start_server {tags {"repl"}} {
|
||||||
|
set second [srv 0 client]
|
||||||
|
set second_host [srv 0 host]
|
||||||
|
set second_port [srv 0 port]
|
||||||
|
|
||||||
|
assert {[$first exists key1] == 1}
|
||||||
|
assert {[$second exists key1] == 0}
|
||||||
|
set ret [r -1 migrate $second_host $second_port "" 9 5000 keys key1 key2 key3]
|
||||||
|
assert {$ret eq {OK}}
|
||||||
|
assert {[$first exists key1] == 0}
|
||||||
|
assert {[$first exists key2] == 0}
|
||||||
|
assert {[$first exists key3] == 0}
|
||||||
|
assert {[$second get key1] eq {v1}}
|
||||||
|
assert {[$second get key2] eq {v2}}
|
||||||
|
assert {[$second get key3] eq {v3}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test {MIGRATE with multiple keys must have empty key arg} {
|
||||||
|
catch {r MIGRATE 127.0.0.1 6379 NotEmpty 9 5000 keys a b c} e
|
||||||
|
set e
|
||||||
|
} {*empty string*}
|
||||||
|
|
||||||
|
test {MIGRATE with mutliple keys migrate just existing ones} {
|
||||||
|
set first [srv 0 client]
|
||||||
|
r set key1 "v1"
|
||||||
|
r set key2 "v2"
|
||||||
|
r set key3 "v3"
|
||||||
|
start_server {tags {"repl"}} {
|
||||||
|
set second [srv 0 client]
|
||||||
|
set second_host [srv 0 host]
|
||||||
|
set second_port [srv 0 port]
|
||||||
|
|
||||||
|
set ret [r -1 migrate $second_host $second_port "" 9 5000 keys nokey-1 nokey-2 nokey-2]
|
||||||
|
assert {$ret eq {NOKEY}}
|
||||||
|
|
||||||
|
assert {[$first exists key1] == 1}
|
||||||
|
assert {[$second exists key1] == 0}
|
||||||
|
set ret [r -1 migrate $second_host $second_port "" 9 5000 keys nokey-1 key1 nokey-2 key2 nokey-3 key3]
|
||||||
|
assert {$ret eq {OK}}
|
||||||
|
assert {[$first exists key1] == 0}
|
||||||
|
assert {[$first exists key2] == 0}
|
||||||
|
assert {[$first exists key3] == 0}
|
||||||
|
assert {[$second get key1] eq {v1}}
|
||||||
|
assert {[$second get key2] eq {v2}}
|
||||||
|
assert {[$second get key3] eq {v3}}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user