summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGabi Ganam <gabiganam@gmail.com>2023-01-08 11:02:48 +0200
committerGitHub <noreply@github.com>2023-01-08 01:02:48 -0800
commiteef29b68a2cd94de1f03aa1b7891af75f5cabae2 (patch)
tree5e2b51f2cf38c146263b20b2b3071fa99bebd5c3 /tests
parentd0cc3de73f91ca79b2343e73e640b40709cfcaf5 (diff)
downloadredis-eef29b68a2cd94de1f03aa1b7891af75f5cabae2.tar.gz
Blocking command with a 0.001 seconds timeout blocks indefinitely (#11688)
Any value in the range of [0-1) turns to 0 when being cast from double to long long. This change rounds up instead of down for values that can't be stored precisely as long doubles.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/type/list.tcl10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit/type/list.tcl b/tests/unit/type/list.tcl
index f7e043f99..7a3768025 100644
--- a/tests/unit/type/list.tcl
+++ b/tests/unit/type/list.tcl
@@ -1263,6 +1263,16 @@ foreach {pop} {BLPOP BLMPOP_LEFT} {
$rd close
}
+ test "$pop: with 0.001 timeout should not block indefinitely" {
+ # Use a timeout of 0.001 and wait for the number of blocked clients to equal 0.
+ # Validate the empty read from the deferring client.
+ set rd [redis_deferring_client]
+ bpop_command $rd $pop blist1 0.001
+ wait_for_blocked_clients_count 0
+ assert_equal {} [$rd read]
+ $rd close
+ }
+
test "$pop: second argument is not a list" {
set rd [redis_deferring_client]
r del blist1{t} blist2{t}