summaryrefslogtreecommitdiffstats
path: root/tests/assets
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:40:54 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:40:54 +0000
commit317c0644ccf108aa23ef3fd8358bd66c2840bfc0 (patch)
treec417b3d25c86b775989cb5ac042f37611b626c8a /tests/assets
parentInitial commit. (diff)
downloadredis-317c0644ccf108aa23ef3fd8358bd66c2840bfc0.tar.xz
redis-317c0644ccf108aa23ef3fd8358bd66c2840bfc0.zip
Adding upstream version 5:7.2.4.upstream/5%7.2.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/assets/corrupt_empty_keys.rdbbin0 -> 280 bytes
-rw-r--r--tests/assets/corrupt_ziplist.rdbbin0 -> 1415 bytes
-rw-r--r--tests/assets/default.conf37
-rw-r--r--tests/assets/encodings.rdbbin0 -> 667 bytes
-rw-r--r--tests/assets/hash-ziplist.rdbbin0 -> 137 bytes
-rw-r--r--tests/assets/hash-zipmap.rdbbin0 -> 35 bytes
-rw-r--r--tests/assets/list-quicklist.rdbbin0 -> 123 bytes
-rw-r--r--tests/assets/minimal.conf5
-rw-r--r--tests/assets/nodefaultuser.acl2
-rw-r--r--tests/assets/rdb-preamble.aofbin0 -> 169 bytes
-rw-r--r--tests/assets/scriptbackup.rdbbin0 -> 225 bytes
-rw-r--r--tests/assets/test_cli_hint_suite.txt111
-rw-r--r--tests/assets/user.acl3
-rw-r--r--tests/assets/userwithselectors.acl2
-rw-r--r--tests/assets/zset-ziplist.rdbbin0 -> 135 bytes
15 files changed, 160 insertions, 0 deletions
diff --git a/tests/assets/corrupt_empty_keys.rdb b/tests/assets/corrupt_empty_keys.rdb
new file mode 100644
index 0000000..98b6a14
--- /dev/null
+++ b/tests/assets/corrupt_empty_keys.rdb
Binary files differ
diff --git a/tests/assets/corrupt_ziplist.rdb b/tests/assets/corrupt_ziplist.rdb
new file mode 100644
index 0000000..b40ada8
--- /dev/null
+++ b/tests/assets/corrupt_ziplist.rdb
Binary files differ
diff --git a/tests/assets/default.conf b/tests/assets/default.conf
new file mode 100644
index 0000000..de460cc
--- /dev/null
+++ b/tests/assets/default.conf
@@ -0,0 +1,37 @@
+# Redis configuration for testing.
+
+always-show-logo yes
+notify-keyspace-events KEA
+daemonize no
+pidfile /var/run/redis.pid
+port 6379
+timeout 0
+bind 127.0.0.1
+loglevel verbose
+logfile ''
+databases 16
+latency-monitor-threshold 1
+repl-diskless-sync-delay 0
+
+# Turn off RDB by default (to speedup tests)
+# Note the infrastructure in server.tcl uses a dict, we can't provide several save directives
+save ''
+
+rdbcompression yes
+dbfilename dump.rdb
+dir ./
+
+slave-serve-stale-data yes
+appendonly no
+appendfsync everysec
+no-appendfsync-on-rewrite no
+activerehashing yes
+
+enable-protected-configs yes
+enable-debug-command yes
+enable-module-command yes
+
+propagation-error-behavior panic
+
+# Make sure shutdown doesn't fail if there's an initial AOFRW
+shutdown-on-sigterm force
diff --git a/tests/assets/encodings.rdb b/tests/assets/encodings.rdb
new file mode 100644
index 0000000..9fd9b70
--- /dev/null
+++ b/tests/assets/encodings.rdb
Binary files differ
diff --git a/tests/assets/hash-ziplist.rdb b/tests/assets/hash-ziplist.rdb
new file mode 100644
index 0000000..bcc39a3
--- /dev/null
+++ b/tests/assets/hash-ziplist.rdb
Binary files differ
diff --git a/tests/assets/hash-zipmap.rdb b/tests/assets/hash-zipmap.rdb
new file mode 100644
index 0000000..27a42ed
--- /dev/null
+++ b/tests/assets/hash-zipmap.rdb
Binary files differ
diff --git a/tests/assets/list-quicklist.rdb b/tests/assets/list-quicklist.rdb
new file mode 100644
index 0000000..a9101a1
--- /dev/null
+++ b/tests/assets/list-quicklist.rdb
Binary files differ
diff --git a/tests/assets/minimal.conf b/tests/assets/minimal.conf
new file mode 100644
index 0000000..ae14ae8
--- /dev/null
+++ b/tests/assets/minimal.conf
@@ -0,0 +1,5 @@
+# Minimal configuration for testing.
+always-show-logo yes
+daemonize no
+pidfile /var/run/redis.pid
+loglevel verbose
diff --git a/tests/assets/nodefaultuser.acl b/tests/assets/nodefaultuser.acl
new file mode 100644
index 0000000..2557c7f
--- /dev/null
+++ b/tests/assets/nodefaultuser.acl
@@ -0,0 +1,2 @@
+user alice on nopass ~* +@all
+user bob on nopass ~* &* +@all \ No newline at end of file
diff --git a/tests/assets/rdb-preamble.aof b/tests/assets/rdb-preamble.aof
new file mode 100644
index 0000000..73f2301
--- /dev/null
+++ b/tests/assets/rdb-preamble.aof
Binary files differ
diff --git a/tests/assets/scriptbackup.rdb b/tests/assets/scriptbackup.rdb
new file mode 100644
index 0000000..963715d
--- /dev/null
+++ b/tests/assets/scriptbackup.rdb
Binary files differ
diff --git a/tests/assets/test_cli_hint_suite.txt b/tests/assets/test_cli_hint_suite.txt
new file mode 100644
index 0000000..18c1fe0
--- /dev/null
+++ b/tests/assets/test_cli_hint_suite.txt
@@ -0,0 +1,111 @@
+# Test suite for redis-cli command-line hinting mechanism.
+# Each test case consists of two strings: a (partial) input command line, and the expected hint string.
+
+# Command with one arg: GET key
+"GET " "key"
+"GET abc " ""
+
+# Command with two args: DECRBY key decrement
+"DECRBY xyz 2 " ""
+"DECRBY xyz " "decrement"
+"DECRBY " "key decrement"
+
+# Command with optional arg: LPOP key [count]
+"LPOP key " "[count]"
+"LPOP key 3 " ""
+
+# Command with optional token arg: XRANGE key start end [COUNT count]
+"XRANGE " "key start end [COUNT count]"
+"XRANGE k 4 2 " "[COUNT count]"
+"XRANGE k 4 2 COU" "[COUNT count]"
+"XRANGE k 4 2 COUNT" "[COUNT count]"
+"XRANGE k 4 2 COUNT " "count"
+
+# Command with optional token block arg: BITFIELD_RO key [GET encoding offset [GET encoding offset ...]]
+"BITFIELD_RO k " "[GET encoding offset [GET encoding offset ...]]"
+"BITFIELD_RO k GE" "[GET encoding offset [GET encoding offset ...]]"
+"BITFIELD_RO k GET" "[GET encoding offset [GET encoding offset ...]]"
+# TODO: The following hints end with an unbalanced "]" which shouldn't be there.
+"BITFIELD_RO k GET " "encoding offset [GET encoding offset ...]]"
+"BITFIELD_RO k GET xyz " "offset [GET encoding offset ...]]"
+"BITFIELD_RO k GET xyz 12 " "[GET encoding offset ...]]"
+"BITFIELD_RO k GET xyz 12 GET " "encoding offset [GET encoding offset ...]]"
+"BITFIELD_RO k GET enc1 12 GET enc2 " "offset [GET encoding offset ...]]"
+"BITFIELD_RO k GET enc1 12 GET enc2 34 " "[GET encoding offset ...]]"
+
+# Two-word command with multiple non-token block args: CONFIG SET parameter value [parameter value ...]
+"CONFIG SET param " "value [parameter value ...]"
+"CONFIG SET param val " "[parameter value ...]"
+"CONFIG SET param val parm2 val2 " "[parameter value ...]"
+
+# Command with nested optional args: ZRANDMEMBER key [count [WITHSCORES]]
+"ZRANDMEMBER k " "[count [WITHSCORES]]"
+"ZRANDMEMBER k 3 " "[WITHSCORES]"
+"ZRANDMEMBER k 3 WI" "[WITHSCORES]"
+"ZRANDMEMBER k 3 WITHSCORES " ""
+# Wrong data type: count must be an integer. Hinting fails.
+"ZRANDMEMBER k cnt " ""
+
+# Command ends with repeated arg: MGET key [key ...]
+"MGET " "key [key ...]"
+"MGET k " "[key ...]"
+"MGET k k " "[key ...]"
+
+# Optional args can be in any order: SCAN cursor [MATCH pattern] [COUNT count] [TYPE type]
+"SCAN 2 MATCH " "pattern [COUNT count] [TYPE type]"
+"SCAN 2 COUNT " "count [MATCH pattern] [TYPE type]"
+
+# One-of choices: BLMOVE source destination LEFT|RIGHT LEFT|RIGHT timeout
+"BLMOVE src dst LEFT " "LEFT|RIGHT timeout"
+
+# Optional args can be in any order: ZRANGE key min max [BYSCORE|BYLEX] [REV] [LIMIT offset count] [WITHSCORES]
+"ZRANGE k 1 2 " "[BYSCORE|BYLEX] [REV] [LIMIT offset count] [WITHSCORES]"
+"ZRANGE k 1 2 bylex " "[REV] [LIMIT offset count] [WITHSCORES]"
+"ZRANGE k 1 2 bylex rev " "[LIMIT offset count] [WITHSCORES]"
+"ZRANGE k 1 2 limit 2 4 " "[BYSCORE|BYLEX] [REV] [WITHSCORES]"
+"ZRANGE k 1 2 bylex rev limit 2 4 WITHSCORES " ""
+"ZRANGE k 1 2 rev " "[BYSCORE|BYLEX] [LIMIT offset count] [WITHSCORES]"
+"ZRANGE k 1 2 WITHSCORES " "[BYSCORE|BYLEX] [REV] [LIMIT offset count]"
+
+# Optional one-of args with parameters: SET key value [NX|XX] [GET] [EX seconds|PX milliseconds|EXAT unix-time-seconds|PXAT unix-time-milliseconds|KEEPTTL]
+"SET key value " "[NX|XX] [GET] [EX seconds|PX milliseconds|EXAT unix-time-seconds|PXAT unix-time-milliseconds|KEEPTTL]"
+"SET key value EX" "[NX|XX] [GET] [EX seconds|PX milliseconds|EXAT unix-time-seconds|PXAT unix-time-milliseconds|KEEPTTL]"
+"SET key value EX " "seconds [NX|XX] [GET]"
+"SET key value EX 23 " "[NX|XX] [GET]"
+"SET key value EXAT" "[NX|XX] [GET] [EX seconds|PX milliseconds|EXAT unix-time-seconds|PXAT unix-time-milliseconds|KEEPTTL]"
+"SET key value EXAT " "unix-time-seconds [NX|XX] [GET]"
+"SET key value PX" "[NX|XX] [GET] [EX seconds|PX milliseconds|EXAT unix-time-seconds|PXAT unix-time-milliseconds|KEEPTTL]"
+"SET key value PX " "milliseconds [NX|XX] [GET]"
+"SET key value PXAT" "[NX|XX] [GET] [EX seconds|PX milliseconds|EXAT unix-time-seconds|PXAT unix-time-milliseconds|KEEPTTL]"
+"SET key value PXAT " "unix-time-milliseconds [NX|XX] [GET]"
+"SET key value KEEPTTL " "[NX|XX] [GET]"
+"SET key value XX " "[GET] [EX seconds|PX milliseconds|EXAT unix-time-seconds|PXAT unix-time-milliseconds|KEEPTTL]"
+
+# If an input word can't be matched, stop hinting.
+"SET key value FOOBAR " ""
+# Incorrect type for EX 'seconds' parameter - stop hinting.
+"SET key value EX sec " ""
+
+# Reordering partially-matched optional argument: GEORADIUS key longitude latitude radius M|KM|FT|MI [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC|DESC] [STORE key|STOREDIST key]
+"GEORADIUS key " "longitude latitude radius M|KM|FT|MI [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC|DESC] [STORE key|STOREDIST key]"
+"GEORADIUS key 1 2 3 M " "[WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC|DESC] [STORE key|STOREDIST key]"
+"GEORADIUS key 1 2 3 M COUNT " "count [ANY] [WITHCOORD] [WITHDIST] [WITHHASH] [ASC|DESC] [STORE key|STOREDIST key]"
+"GEORADIUS key 1 2 3 M COUNT 12 " "[ANY] [WITHCOORD] [WITHDIST] [WITHHASH] [ASC|DESC] [STORE key|STOREDIST key]"
+"GEORADIUS key 1 2 3 M COUNT 12 " "[ANY] [WITHCOORD] [WITHDIST] [WITHHASH] [ASC|DESC] [STORE key|STOREDIST key]"
+"GEORADIUS key 1 -2.345 3 M COUNT 12 " "[ANY] [WITHCOORD] [WITHDIST] [WITHHASH] [ASC|DESC] [STORE key|STOREDIST key]"" ""
+# Wrong data type: latitude must be a double. Hinting fails.
+"GEORADIUS key 1 X " ""
+# Once the next optional argument is started, the [ANY] hint completing the COUNT argument disappears.
+"GEORADIUS key 1 2 3 M COUNT 12 ASC " "[WITHCOORD] [WITHDIST] [WITHHASH] [STORE key|STOREDIST key]"
+
+# Incorrect argument type for double-valued token parameter.
+"GEOSEARCH k FROMLONLAT " "longitude latitude BYRADIUS radius M|KM|FT|MI|BYBOX width height M|KM|FT|MI [ASC|DESC] [COUNT count [ANY]] [WITHCOORD] [WITHDIST] [WITHHASH]"
+"GEOSEARCH k FROMLONLAT 2.34 4.45 BYRADIUS badvalue " ""
+
+# Optional parameters followed by mandatory params: ZADD key [NX|XX] [GT|LT] [CH] [INCR] score member [score member ...]
+"ZADD key " "[NX|XX] [GT|LT] [CH] [INCR] score member [score member ...]"
+"ZADD key CH LT " "[NX|XX] [INCR] score member [score member ...]"
+"ZADD key 0 " "member [score member ...]"
+
+# Empty-valued token argument represented as a pair of double-quotes.
+"MIGRATE " "host port key|\"\" destination-db timeout [COPY] [REPLACE] [AUTH password|AUTH2 username password] [KEYS key [key ...]]"
diff --git a/tests/assets/user.acl b/tests/assets/user.acl
new file mode 100644
index 0000000..926ac54
--- /dev/null
+++ b/tests/assets/user.acl
@@ -0,0 +1,3 @@
+user alice on allcommands allkeys &* >alice
+user bob on -@all +@set +acl ~set* &* >bob
+user default on nopass ~* &* +@all
diff --git a/tests/assets/userwithselectors.acl b/tests/assets/userwithselectors.acl
new file mode 100644
index 0000000..5d42957
--- /dev/null
+++ b/tests/assets/userwithselectors.acl
@@ -0,0 +1,2 @@
+user alice on (+get ~rw*)
+user bob on (+set %W~w*) (+get %R~r*) \ No newline at end of file
diff --git a/tests/assets/zset-ziplist.rdb b/tests/assets/zset-ziplist.rdb
new file mode 100644
index 0000000..d554947
--- /dev/null
+++ b/tests/assets/zset-ziplist.rdb
Binary files differ