From 7cb42c9c36bbf410205742b2bc0cb95aeaefdc51 Mon Sep 17 00:00:00 2001 From: Oran Agra Date: Tue, 1 Jun 2021 12:51:30 +0300 Subject: [PATCH] add test for modules load/unload and config rewrite --- runtest-moduleapi | 1 + tests/unit/moduleapi/infra.tcl | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/unit/moduleapi/infra.tcl diff --git a/runtest-moduleapi b/runtest-moduleapi index 7c17501e0..11d496a27 100755 --- a/runtest-moduleapi +++ b/runtest-moduleapi @@ -19,6 +19,7 @@ $TCLSH tests/test_helper.tcl \ --single unit/moduleapi/fork \ --single unit/moduleapi/testrdb \ --single unit/moduleapi/infotest \ +--single unit/moduleapi/infra \ --single unit/moduleapi/propagate \ --single unit/moduleapi/hooks \ --single unit/moduleapi/misc \ diff --git a/tests/unit/moduleapi/infra.tcl b/tests/unit/moduleapi/infra.tcl new file mode 100644 index 000000000..077487457 --- /dev/null +++ b/tests/unit/moduleapi/infra.tcl @@ -0,0 +1,22 @@ +set testmodule [file normalize tests/modules/infotest.so] + +test {modules config rewrite} { + + start_server {tags {"modules"}} { + r module load $testmodule + + assert_equal [lindex [lindex [r module list] 0] 1] infotest + + r config rewrite + restart_server 0 true false + + assert_equal [lindex [lindex [r module list] 0] 1] infotest + + r module unload infotest + + r config rewrite + restart_server 0 true false + + assert_equal [llength [r module list]] 0 + } +}