Skip to content

Commit

Permalink
Update test case
Browse files Browse the repository at this point in the history
  • Loading branch information
hwware committed Oct 31, 2024
1 parent cbfd1d5 commit 1d41272
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 1 addition & 5 deletions tests/modules/moduleparameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ int GET_HELLO(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int argc) {
VALKEYMODULE_NOT_USED(argv);
VALKEYMODULE_NOT_USED(argc);

ValkeyModuleRunTimeArgs *ret = ValkeyModule_GetRunTimeArgs(ctx);
ValkeyModule_Log(ctx, "warning", "dbsize command arg number is %d",
ret->argc);
ValkeyModule_Log(ctx, "warning", "dbsize command arg 0 is %s",
ret->argv[0]);
ValkeyModule_UpdateRunTimeArgs(ctx, 0, "99");
return ValkeyModule_ReplyWithSimpleString(ctx, "Module runtime args test");
}

Expand Down
11 changes: 11 additions & 0 deletions tests/unit/moduleapi/moduleconfigs.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,17 @@ start_server {tags {"modules"}} {
}
}

test {Module Update Args } {
r module load $testmoduleparameter 10 20 30

set t [r module list]
set modulename [lmap x [r module list] {dict get $x name}]
assert_not_equal [lsearch $modulename myhello] -1
string match "10 20 30" [lmap x [r module list] {dict get $x args}]
r hello.hi
string match "99 20 30" [lmap x [r module list] {dict get $x args}]
}

}


Expand Down

0 comments on commit 1d41272

Please sign in to comment.