summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-10-24 10:41:25 +0200
committerantirez <antirez@gmail.com>2019-10-24 10:41:25 +0200
commit39f2ab595cb4adb7eb964a2317734f8f7d2892b4 (patch)
tree57366b0d6a781764333551852992f4a3adf5ea88
parent7cefbeaad5dc299e9b9e26fbb1f517012756a89a (diff)
downloadredis-39f2ab595cb4adb7eb964a2317734f8f7d2892b4.tar.gz
Modules hooks: initial Tcl test file.
-rwxr-xr-xruntest-moduleapi2
-rw-r--r--tests/unit/moduleapi/hooks.tcl18
2 files changed, 19 insertions, 1 deletions
diff --git a/runtest-moduleapi b/runtest-moduleapi
index a16cca686..444204919 100755
--- a/runtest-moduleapi
+++ b/runtest-moduleapi
@@ -13,4 +13,4 @@ then
fi
make -C tests/modules && \
-$TCLSH tests/test_helper.tcl --single unit/moduleapi/commandfilter --single unit/moduleapi/fork --single unit/moduleapi/testrdb --single unit/moduleapi/infotest --single unit/moduleapi/propagate "${@}"
+$TCLSH tests/test_helper.tcl --single unit/moduleapi/commandfilter --single unit/moduleapi/fork --single unit/moduleapi/testrdb --single unit/moduleapi/infotest --single unit/moduleapi/propagate --single unit/moduleapi/hooks "${@}"
diff --git a/tests/unit/moduleapi/hooks.tcl b/tests/unit/moduleapi/hooks.tcl
new file mode 100644
index 000000000..473c8fdd1
--- /dev/null
+++ b/tests/unit/moduleapi/hooks.tcl
@@ -0,0 +1,18 @@
+set testmodule [file normalize tests/modules/hooks.so]
+
+tags "modules" {
+ start_server {} {
+ r module load $testmodule
+ test {Test clients connection / disconnection hooks} {
+ for {set j 0} {$j < 2} {incr j} {
+ set rd1 [redis_deferring_client]
+ $rd1 close
+ }
+
+ r select 0
+ puts "Keys: [r keys *]"
+ assert {[r llen connected] > 1}
+ assert {[r llen disconnected] > 1}
+ }
+ }
+}