aboutsummaryrefslogtreecommitdiff
path: root/examples/redis-unstable/tests/unit/cluster/misc.tcl
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 22:40:55 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 22:40:55 +0100
commit5d8dfe892a2ea89f706ee140c3bdcfd89fe03fda (patch)
tree1acdfa5220cd13b7be43a2a01368e80d306473ca /examples/redis-unstable/tests/unit/cluster/misc.tcl
parentc7ab12bba64d9c20ccd79b132dac475f7bc3923e (diff)
downloadcrep-5d8dfe892a2ea89f706ee140c3bdcfd89fe03fda.tar.gz
Add Redis source code for testing
Diffstat (limited to 'examples/redis-unstable/tests/unit/cluster/misc.tcl')
-rw-r--r--examples/redis-unstable/tests/unit/cluster/misc.tcl36
1 files changed, 36 insertions, 0 deletions
diff --git a/examples/redis-unstable/tests/unit/cluster/misc.tcl b/examples/redis-unstable/tests/unit/cluster/misc.tcl
new file mode 100644
index 0000000..62bdcf7
--- /dev/null
+++ b/examples/redis-unstable/tests/unit/cluster/misc.tcl
@@ -0,0 +1,36 @@
1start_cluster 2 2 {tags {external:skip cluster}} {
2 test {Key lazy expires during key migration} {
3 R 0 DEBUG SET-ACTIVE-EXPIRE 0
4
5 set key_slot [R 0 CLUSTER KEYSLOT FOO]
6 R 0 set FOO BAR PX 10
7 set src_id [R 0 CLUSTER MYID]
8 set trg_id [R 1 CLUSTER MYID]
9 R 0 CLUSTER SETSLOT $key_slot MIGRATING $trg_id
10 R 1 CLUSTER SETSLOT $key_slot IMPORTING $src_id
11 after 11
12 assert_error {ASK*} {R 0 GET FOO}
13 R 0 ping
14 } {PONG}
15
16 test "Coverage: Basic cluster commands" {
17 assert_equal {OK} [R 0 CLUSTER saveconfig]
18
19 set id [R 0 CLUSTER MYID]
20 assert_equal {0} [R 0 CLUSTER count-failure-reports $id]
21
22 R 0 flushall
23 assert_equal {OK} [R 0 CLUSTER flushslots]
24 }
25
26 test "CROSSSLOT error for keys in different slots" {
27 # Test MSET with keys in different slots
28 assert_error {*CROSSSLOT Keys in request don't hash to the same slot*} {R 0 MSET foo bar baz qux}
29
30 # Test DEL with keys in different slots
31 assert_error {*CROSSSLOT Keys in request don't hash to the same slot*} {R 0 DEL foo bar}
32
33 # Test MGET with keys in different slots
34 assert_error {*CROSSSLOT Keys in request don't hash to the same slot*} {R 0 MGET foo bar}
35 }
36}