From 317c0644ccf108aa23ef3fd8358bd66c2840bfc0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 15:40:54 +0200 Subject: Adding upstream version 5:7.2.4. Signed-off-by: Daniel Baumann --- tests/assets/corrupt_empty_keys.rdb | Bin 0 -> 280 bytes tests/assets/corrupt_ziplist.rdb | Bin 0 -> 1415 bytes tests/assets/default.conf | 37 ++++++++++++ tests/assets/encodings.rdb | Bin 0 -> 667 bytes tests/assets/hash-ziplist.rdb | Bin 0 -> 137 bytes tests/assets/hash-zipmap.rdb | Bin 0 -> 35 bytes tests/assets/list-quicklist.rdb | Bin 0 -> 123 bytes tests/assets/minimal.conf | 5 ++ tests/assets/nodefaultuser.acl | 2 + tests/assets/rdb-preamble.aof | Bin 0 -> 169 bytes tests/assets/scriptbackup.rdb | Bin 0 -> 225 bytes tests/assets/test_cli_hint_suite.txt | 111 +++++++++++++++++++++++++++++++++++ tests/assets/user.acl | 3 + tests/assets/userwithselectors.acl | 2 + tests/assets/zset-ziplist.rdb | Bin 0 -> 135 bytes 15 files changed, 160 insertions(+) create mode 100644 tests/assets/corrupt_empty_keys.rdb create mode 100644 tests/assets/corrupt_ziplist.rdb create mode 100644 tests/assets/default.conf create mode 100644 tests/assets/encodings.rdb create mode 100644 tests/assets/hash-ziplist.rdb create mode 100644 tests/assets/hash-zipmap.rdb create mode 100644 tests/assets/list-quicklist.rdb create mode 100644 tests/assets/minimal.conf create mode 100644 tests/assets/nodefaultuser.acl create mode 100644 tests/assets/rdb-preamble.aof create mode 100644 tests/assets/scriptbackup.rdb create mode 100644 tests/assets/test_cli_hint_suite.txt create mode 100644 tests/assets/user.acl create mode 100644 tests/assets/userwithselectors.acl create mode 100644 tests/assets/zset-ziplist.rdb (limited to 'tests/assets') diff --git a/tests/assets/corrupt_empty_keys.rdb b/tests/assets/corrupt_empty_keys.rdb new file mode 100644 index 0000000..98b6a14 Binary files /dev/null and b/tests/assets/corrupt_empty_keys.rdb differ diff --git a/tests/assets/corrupt_ziplist.rdb b/tests/assets/corrupt_ziplist.rdb new file mode 100644 index 0000000..b40ada8 Binary files /dev/null and b/tests/assets/corrupt_ziplist.rdb 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 Binary files /dev/null and b/tests/assets/encodings.rdb differ diff --git a/tests/assets/hash-ziplist.rdb b/tests/assets/hash-ziplist.rdb new file mode 100644 index 0000000..bcc39a3 Binary files /dev/null and b/tests/assets/hash-ziplist.rdb differ diff --git a/tests/assets/hash-zipmap.rdb b/tests/assets/hash-zipmap.rdb new file mode 100644 index 0000000..27a42ed Binary files /dev/null and b/tests/assets/hash-zipmap.rdb differ diff --git a/tests/assets/list-quicklist.rdb b/tests/assets/list-quicklist.rdb new file mode 100644 index 0000000..a9101a1 Binary files /dev/null and b/tests/assets/list-quicklist.rdb 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 Binary files /dev/null and b/tests/assets/rdb-preamble.aof differ diff --git a/tests/assets/scriptbackup.rdb b/tests/assets/scriptbackup.rdb new file mode 100644 index 0000000..963715d Binary files /dev/null and b/tests/assets/scriptbackup.rdb 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 Binary files /dev/null and b/tests/assets/zset-ziplist.rdb differ -- cgit v1.2.3