Skip to content

Commit

Permalink
Update test case name
Browse files Browse the repository at this point in the history
  • Loading branch information
hwware committed Nov 8, 2024
1 parent e260229 commit d62c9cd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -2258,7 +2258,6 @@ int moduleIsModuleCommand(void *module_handle, struct serverCommand *cmd) {
* The function parameter 'argc' indicates the number of updated arguments, and 'argv'
* represents the values of the updated arguments.
* Once 'CONFIG REWRITE' command is called, the updated argument values can be saved into conf file.
* One example can be found in file tests/modules/moduleparameter.c.
*
* Returns:
* - VALKEYMODULE_OK on successfully updating.
Expand Down
1 change: 0 additions & 1 deletion src/redismodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@
#define RedisModule_SetModuleAttribs ValkeyModule_SetModuleAttribs
#define RedisModule_IsModuleNameBusy ValkeyModule_IsModuleNameBusy
#define RedisModule_WrongArity ValkeyModule_WrongArity
#define RedisModule_UpdateRuntimeArgs ValkeyModule_UpdateRuntimeArgs
#define RedisModule_ReplyWithLongLong ValkeyModule_ReplyWithLongLong
#define RedisModule_GetSelectedDb ValkeyModule_GetSelectedDb
#define RedisModule_SelectDb ValkeyModule_SelectDb
Expand Down
16 changes: 9 additions & 7 deletions tests/modules/moduleparameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#include <ctype.h>
#include <string.h>

int GET_HELLO(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int argc) {
int test_module_update_parameter(ValkeyModuleCtx *ctx,
ValkeyModuleString **argv, int argc) {
ValkeyModule_UpdateRuntimeArgs(ctx, argv, argc);
return ValkeyModule_ReplyWithSimpleString(ctx, "Module runtime args test");
}
Expand All @@ -13,13 +14,14 @@ int ValkeyModule_OnLoad(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int arg
VALKEYMODULE_NOT_USED(argv);
VALKEYMODULE_NOT_USED(argc);

if (ValkeyModule_Init(ctx,"myhello",1,VALKEYMODULE_APIVER_1)
== VALKEYMODULE_ERR) return VALKEYMODULE_ERR;
if (ValkeyModule_Init(ctx, "moduleparameter", 1, VALKEYMODULE_APIVER_1) ==
VALKEYMODULE_ERR)
return VALKEYMODULE_ERR;


if (ValkeyModule_CreateCommand(ctx,"hello.hi",
GET_HELLO,"fast",0,0,0) == VALKEYMODULE_ERR)
return VALKEYMODULE_ERR;
if (ValkeyModule_CreateCommand(ctx, "testmoduleparameter.update.parameter",
test_module_update_parameter, "fast", 0, 0,
0) == VALKEYMODULE_ERR)
return VALKEYMODULE_ERR;

return VALKEYMODULE_OK;
}
4 changes: 2 additions & 2 deletions tests/unit/moduleapi/moduleconfigs.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ start_server {tags {"modules"}} {

set t [r module list]
set modulename [lmap x [r module list] {dict get $x name}]
assert_not_equal [lsearch $modulename myhello] -1
assert_not_equal [lsearch $modulename moduleparameter] -1
string match "10 20 30" [lmap x [r module list] {dict get $x args}]
r hello.hi 40 50 60 70
r testmoduleparameter.update.parameter 40 50 60 70
string match "40 50 60 70" [lmap x [r module list] {dict get $x args}]
}
}

0 comments on commit d62c9cd

Please sign in to comment.