summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDvir Volk <dvirsky@gmail.com>2017-11-27 23:13:45 +0200
committerDvir Volk <dvirsky@gmail.com>2018-02-14 21:38:58 +0200
commit896db12b418877967d7689e2731c266d8dd1d4f9 (patch)
tree756586d8ed5fb8078602584486cb624bac31be2b
parent2136035e47c5c50aec07270e0c87a9e5cd5e243d (diff)
downloadredis-896db12b418877967d7689e2731c266d8dd1d4f9.tar.gz
fixed test
-rw-r--r--src/modules/testmodule.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/modules/testmodule.c b/src/modules/testmodule.c
index e360866f9..8ab8c4ea3 100644
--- a/src/modules/testmodule.c
+++ b/src/modules/testmodule.c
@@ -155,7 +155,8 @@ int TestUnlink(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
}
int NotifyCallback(RedisModuleCtx *ctx, int type, const char *event, RedisModuleString *key) {
- // Increment a counter on the notifications
+ // Increment a counter on the notifications:
+ // for each key notified we increment a counter
RedisModule_Log(ctx, "notice", "Got event type %d, event %s, key %s\n", type, event, RedisModule_StringPtrLen(key, NULL));
RedisModule_Call(ctx, "HINCRBY", "csc", "notifications", key, "1");
@@ -218,13 +219,18 @@ int TestNotifications(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
FAIL("Got reply '%.*s'. expected '1'", sz, rep);
}
}
+ // for l we expect nothing since we didn't subscribe to list events
r = RedisModule_Call(ctx, "HGET", "cc", "notifications", "l");
if (r == NULL || RedisModule_CallReplyType(r) != REDISMODULE_REPLY_NULL) {
FAIL("Wrong reply for l");
}
+ RedisModule_Call(ctx, "FLUSHDB", "");
+
return RedisModule_ReplyWithSimpleString(ctx, "OK");
err:
+ RedisModule_Call(ctx, "FLUSHDB", "");
+
return RedisModule_ReplyWithSimpleString(ctx, "ERR");
}