mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
c3f9e01794
Adding [B]LMOVE <src> <dst> RIGHT|LEFT RIGHT|LEFT. deprecating [B]RPOPLPUSH. Note that when receiving a BRPOPLPUSH we'll still propagate an RPOPLPUSH, but on BLMOVE RIGHT LEFT we'll propagate an LMOVE improvement to existing tests - Replace "after 1000" with "wait_for_condition" when wait for clients to block/unblock. - Add a pre-existing element to target list on basic tests so that we can check if the new element was added to the correct side of the list. - check command stats on the replica to make sure the right command was replicated Co-authored-by: Oran Agra <oran@redislabs.com>
79 lines
2.1 KiB
Tcl
79 lines
2.1 KiB
Tcl
proc cmdstat {cmd} {
|
|
return [cmdrstat $cmd r]
|
|
}
|
|
|
|
start_server {tags {"introspection"}} {
|
|
test {TTL and TYPYE do not alter the last access time of a key} {
|
|
r set foo bar
|
|
after 3000
|
|
r ttl foo
|
|
r type foo
|
|
assert {[r object idletime foo] >= 2}
|
|
}
|
|
|
|
test {TOUCH alters the last access time of a key} {
|
|
r set foo bar
|
|
after 3000
|
|
r touch foo
|
|
assert {[r object idletime foo] < 2}
|
|
}
|
|
|
|
test {TOUCH returns the number of existing keys specified} {
|
|
r flushdb
|
|
r set key1 1
|
|
r set key2 2
|
|
r touch key0 key1 key2 key3
|
|
} 2
|
|
|
|
test {command stats for GEOADD} {
|
|
r config resetstat
|
|
r GEOADD foo 0 0 bar
|
|
assert_match {*calls=1,*} [cmdstat geoadd]
|
|
assert_match {} [cmdstat zadd]
|
|
}
|
|
|
|
test {command stats for EXPIRE} {
|
|
r config resetstat
|
|
r SET foo bar
|
|
r EXPIRE foo 0
|
|
assert_match {*calls=1,*} [cmdstat expire]
|
|
assert_match {} [cmdstat del]
|
|
}
|
|
|
|
test {command stats for BRPOP} {
|
|
r config resetstat
|
|
r LPUSH list foo
|
|
r BRPOP list 0
|
|
assert_match {*calls=1,*} [cmdstat brpop]
|
|
assert_match {} [cmdstat rpop]
|
|
}
|
|
|
|
test {command stats for MULTI} {
|
|
r config resetstat
|
|
r MULTI
|
|
r set foo bar
|
|
r GEOADD foo2 0 0 bar
|
|
r EXPIRE foo2 0
|
|
r EXEC
|
|
assert_match {*calls=1,*} [cmdstat multi]
|
|
assert_match {*calls=1,*} [cmdstat exec]
|
|
assert_match {*calls=1,*} [cmdstat set]
|
|
assert_match {*calls=1,*} [cmdstat expire]
|
|
assert_match {*calls=1,*} [cmdstat geoadd]
|
|
}
|
|
|
|
test {command stats for scripts} {
|
|
r config resetstat
|
|
r set mykey myval
|
|
r eval {
|
|
redis.call('set', KEYS[1], 0)
|
|
redis.call('expire', KEYS[1], 0)
|
|
redis.call('geoadd', KEYS[1], 0, 0, "bar")
|
|
} 1 mykey
|
|
assert_match {*calls=1,*} [cmdstat eval]
|
|
assert_match {*calls=2,*} [cmdstat set]
|
|
assert_match {*calls=1,*} [cmdstat expire]
|
|
assert_match {*calls=1,*} [cmdstat geoadd]
|
|
}
|
|
}
|