Unverified Commit 5a77d015 authored by guybe7's avatar guybe7 Committed by GitHub
Browse files

Fix misleading module test (#8366)

the test was misleading because the module would actually woke up on a wrong type and
re-blocked, while the test name suggests the module doesn't not wake up at all on a wrong type..

i changed the name of the test + added verification that indeed the module wakes up and gets
re-blocked after it understand it's the wrong type
parent baf92f3f
...@@ -65,6 +65,7 @@ int get_fsl(RedisModuleCtx *ctx, RedisModuleString *keyname, int mode, int creat ...@@ -65,6 +65,7 @@ int get_fsl(RedisModuleCtx *ctx, RedisModuleString *keyname, int mode, int creat
RedisModule_CloseKey(key); RedisModule_CloseKey(key);
if (reply_on_failure) if (reply_on_failure)
RedisModule_ReplyWithError(ctx, REDISMODULE_ERRORMSG_WRONGTYPE); RedisModule_ReplyWithError(ctx, REDISMODULE_ERRORMSG_WRONGTYPE);
RedisModule_Call(ctx, "INCR", "c", "fsl_wrong_type");
return 0; return 0;
} }
......
...@@ -168,7 +168,7 @@ start_server {tags {"modules"}} { ...@@ -168,7 +168,7 @@ start_server {tags {"modules"}} {
assert_error "*unblocked*" {$rd read} assert_error "*unblocked*" {$rd read}
} }
test {Module client blocked on keys does not wake up on wrong type} { test {Module client re-blocked on keys after woke up on wrong type} {
r del k r del k
set rd [redis_deferring_client] set rd [redis_deferring_client]
$rd fsl.bpop k 0 $rd fsl.bpop k 0
...@@ -184,6 +184,7 @@ start_server {tags {"modules"}} { ...@@ -184,6 +184,7 @@ start_server {tags {"modules"}} {
r del k r del k
r fsl.push k 34 r fsl.push k 34
assert_equal {34} [$rd read] assert_equal {34} [$rd read]
assert_equal {1} [r get fsl_wrong_type] ;# first lpush caused one wrong-type wake-up
} }
test {Module client blocked on keys woken up by LPUSH} { test {Module client blocked on keys woken up by LPUSH} {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment