aboutsummaryrefslogtreecommitdiff
path: root/examples/redis-unstable/tests/unit/moduleapi/basics.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'examples/redis-unstable/tests/unit/moduleapi/basics.tcl')
-rw-r--r--examples/redis-unstable/tests/unit/moduleapi/basics.tcl70
1 files changed, 0 insertions, 70 deletions
diff --git a/examples/redis-unstable/tests/unit/moduleapi/basics.tcl b/examples/redis-unstable/tests/unit/moduleapi/basics.tcl
deleted file mode 100644
index 49ea9f3..0000000
--- a/examples/redis-unstable/tests/unit/moduleapi/basics.tcl
+++ /dev/null
@@ -1,70 +0,0 @@
1set testmodule [file normalize tests/modules/basics.so]
2
3start_server {tags {"modules external:skip"}} {
4 r module load $testmodule
5
6 test {test module api basics} {
7 r test.basics
8 } {ALL TESTS PASSED}
9
10 test {test rm_call auto mode} {
11 r hello 2
12 set reply [r test.rmcallautomode]
13 assert_equal [lindex $reply 0] f1
14 assert_equal [lindex $reply 1] v1
15 assert_equal [lindex $reply 2] f2
16 assert_equal [lindex $reply 3] v2
17 r hello 3
18 set reply [r test.rmcallautomode]
19 assert_equal [dict get $reply f1] v1
20 assert_equal [dict get $reply f2] v2
21 }
22
23 test {test get resp} {
24 foreach resp {3 2} {
25 if {[lsearch $::denytags "resp3"] >= 0} {
26 if {$resp == 3} {continue}
27 } elseif {$::force_resp3} {
28 if {$resp == 2} {continue}
29 }
30 r hello $resp
31 set reply [r test.getresp]
32 assert_equal $reply $resp
33 r hello 2
34 }
35 }
36
37 test "Unload the module - test" {
38 assert_equal {OK} [r module unload test]
39 }
40}
41
42start_server {tags {"modules external:skip"} overrides {enable-module-command no}} {
43 test {module command disabled} {
44 assert_error "ERR *MODULE command not allowed*" {r module load $testmodule}
45 }
46}
47
48start_server {tags {"modules external:skip"} overrides {enable-debug-command no}} {
49 r module load $testmodule
50
51 test {debug command disabled} {
52 assert_equal {no} [r test.candebug]
53 }
54}
55
56start_server {tags {"modules external:skip"} overrides {enable-debug-command yes}} {
57 r module load $testmodule
58
59 test {debug command enabled} {
60 assert_equal {yes} [r test.candebug]
61 }
62}
63
64start_server {tags {"modules external:skip"} overrides {enable-debug-command local}} {
65 r module load $testmodule
66
67 test {debug commands are enabled for local connection} {
68 assert_equal {yes} [r test.candebug]
69 }
70}