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
53b85e53
Commit
53b85e53
authored
Nov 27, 2017
by
Dvir Volk
Committed by
antirez
Feb 15, 2018
Browse files
fixed test
parent
b43f66c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/modules/testmodule.c
View file @
53b85e53
...
@@ -155,7 +155,8 @@ int TestUnlink(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
...
@@ -155,7 +155,8 @@ int TestUnlink(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
}
}
int
NotifyCallback
(
RedisModuleCtx
*
ctx
,
int
type
,
const
char
*
event
,
RedisModuleString
*
key
)
{
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_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"
);
RedisModule_Call
(
ctx
,
"HINCRBY"
,
"csc"
,
"notifications"
,
key
,
"1"
);
...
@@ -218,13 +219,18 @@ int TestNotifications(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
...
@@ -218,13 +219,18 @@ int TestNotifications(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
FAIL
(
"Got reply '%.*s'. expected '1'"
,
sz
,
rep
);
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"
);
r
=
RedisModule_Call
(
ctx
,
"HGET"
,
"cc"
,
"notifications"
,
"l"
);
if
(
r
==
NULL
||
RedisModule_CallReplyType
(
r
)
!=
REDISMODULE_REPLY_NULL
)
{
if
(
r
==
NULL
||
RedisModule_CallReplyType
(
r
)
!=
REDISMODULE_REPLY_NULL
)
{
FAIL
(
"Wrong reply for l"
);
FAIL
(
"Wrong reply for l"
);
}
}
RedisModule_Call
(
ctx
,
"FLUSHDB"
,
""
);
return
RedisModule_ReplyWithSimpleString
(
ctx
,
"OK"
);
return
RedisModule_ReplyWithSimpleString
(
ctx
,
"OK"
);
err:
err:
RedisModule_Call
(
ctx
,
"FLUSHDB"
,
""
);
return
RedisModule_ReplyWithSimpleString
(
ctx
,
"ERR"
);
return
RedisModule_ReplyWithSimpleString
(
ctx
,
"ERR"
);
}
}
...
...
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