Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
daef1f00
Unverified
Commit
daef1f00
authored
Aug 27, 2020
by
Oran Agra
Committed by
GitHub
Aug 27, 2020
Browse files
Add test coverage for CLIENT UNBLOCK (#7712)
plus minor other fixes to list.tcl
parent
21784def
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/unit/type/list.tcl
View file @
daef1f00
proc wait_for_blocked_client
{}
{
wait_for_condition 50 100
{
[
s blocked_clients
]
ne 0
}
else
{
fail
"no blocked clients"
}
}
start_server
{
tags
{
"list"
}
overrides
{
...
...
@@ -52,7 +60,7 @@ start_server {
test
{
LPOS when RANK is greater than matches
}
{
r DEL mylist
r LPUSH
l
a
r LPUSH
mylist
a
assert
{[
r LPOS mylist b COUNT 10 RANK 5
]
eq
{}}
}
...
...
@@ -217,6 +225,8 @@ start_server {
r del list
$rd blpop list 0
after 100
;
# Make sure rd is blocked before MULTI
r multi
r lpush list a
r del list
...
...
@@ -887,4 +897,45 @@ start_server {
$rd2 close
r ping
}
{
PONG
}
test
"client unblock tests"
{
r del l
set rd
[
redis_deferring_client
]
$rd client id
set id
[
$rd
read
]
# test default args
$rd blpop l 0
wait_for_blocked_client
r client unblock $id
assert_equal
{}
[
$rd
read
]
# test with timeout
$rd blpop l 0
wait_for_blocked_client
r client unblock $id TIMEOUT
assert_equal
{}
[
$rd
read
]
# test with error
$rd blpop l 0
wait_for_blocked_client
r client unblock $id ERROR
catch
{[
$rd
read
]}
e
assert_equal $e
"UNBLOCKED client unblocked via CLIENT UNBLOCK"
# test with invalid client id
catch
{[
r client unblock asd
]}
e
assert_equal $e
"ERR value is not an integer or out of range"
# test with non blocked client
set myid
[
r client id
]
catch
{[
r client unblock $myid
]}
e
assert_equal $e
{
invalid command name
"0"
}
# finally, see the this client and list are still functional
$rd blpop l 0
wait_for_blocked_client
r lpush l foo
assert_equal
{
l foo
}
[
$rd
read
]
}
{}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment