From a2fe6af457e353425d39c858b8cf68f1b4d6a9b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20S=C3=B6derqvist?= Date: Sat, 7 Dec 2024 10:25:40 +0100 Subject: [PATCH] Fix Module Update Args test when other modules are loaded (#1403) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #1400 Signed-off-by: Viktor Söderqvist --- tests/unit/moduleapi/moduleconfigs.tcl | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/unit/moduleapi/moduleconfigs.tcl b/tests/unit/moduleapi/moduleconfigs.tcl index 54de5f2611..2474ad3567 100644 --- a/tests/unit/moduleapi/moduleconfigs.tcl +++ b/tests/unit/moduleapi/moduleconfigs.tcl @@ -2,6 +2,14 @@ set testmodule [file normalize tests/modules/moduleconfigs.so] set testmoduletwo [file normalize tests/modules/moduleconfigstwo.so] set testmoduleparameter [file normalize tests/modules/moduleparameter.so] +proc module_get_args {mod} { + foreach line [r module list] { + if {[dict get $line name] eq $mod} { + return [dict get $line args] + } + } + throw error {module not found} +} start_server {tags {"modules"}} { r module load $testmodule @@ -246,13 +254,13 @@ start_server {tags {"modules"}} { } } test {Module Update Args} { - r module load $testmoduleparameter 10 20 30 + 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 moduleparameter] -1 - assert_equal "{10 20 30}" [lmap x [r module list] {dict get $x args}] - assert_equal OK [r testmoduleparameter.update.parameter 40 50 60 70] - assert_equal "{40 50 60 70}" [lmap x [r module list] {dict get $x args}] + set t [r module list] + set modulename [lmap x [r module list] {dict get $x name}] + assert_not_equal [lsearch $modulename moduleparameter] -1 + assert_equal {10 20 30} [module_get_args moduleparameter] + assert_equal OK [r testmoduleparameter.update.parameter 40 50 60 70] + assert_equal {40 50 60 70} [module_get_args moduleparameter] } }