mirror of
https://github.com/fluencelabs/redis
synced 2025-03-30 22:31:03 +00:00
Tests for CLIENT GETNAME/SETNAME.
This commit is contained in:
parent
9b89ab06c4
commit
ea1f503cfe
@ -19,4 +19,37 @@ start_server {tags {"introspection"}} {
|
|||||||
assert_match {*eval*} [$rd read]
|
assert_match {*eval*} [$rd read]
|
||||||
assert_match {*lua*"set"*"foo"*"bar"*} [$rd read]
|
assert_match {*lua*"set"*"foo"*"bar"*} [$rd read]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test {CLIENT GETNAME should return NIL if name is not assigned} {
|
||||||
|
r client getname
|
||||||
|
} {}
|
||||||
|
|
||||||
|
test {CLIENT LIST shows empty fields for unassigned names} {
|
||||||
|
r client list
|
||||||
|
} {*name= *}
|
||||||
|
|
||||||
|
test {CLIENT SETNAME does not accept spaces} {
|
||||||
|
catch {r client setname "foo bar"} e
|
||||||
|
set e
|
||||||
|
} {ERR*}
|
||||||
|
|
||||||
|
test {CLIENT SETNAME can assign a name to this connection} {
|
||||||
|
assert_equal [r client setname myname] {OK}
|
||||||
|
r client list
|
||||||
|
} {*name=myname*}
|
||||||
|
|
||||||
|
test {CLIENT SETNAME can change the name of an existing connection} {
|
||||||
|
assert_equal [r client setname someothername] {OK}
|
||||||
|
r client list
|
||||||
|
} {*name=someothername*}
|
||||||
|
|
||||||
|
test {After CLIENT SETNAME, connection can still be closed} {
|
||||||
|
set rd [redis_deferring_client]
|
||||||
|
$rd client setname foobar
|
||||||
|
assert_equal [$rd read] "OK"
|
||||||
|
assert_match {*foobar*} [r client list]
|
||||||
|
$rd close
|
||||||
|
# Now the client should no longer be listed
|
||||||
|
string match {*foobar*} [r client list]
|
||||||
|
} {0}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user