summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-05-07 16:04:45 +0200
committerantirez <antirez@gmail.com>2014-05-07 16:17:11 +0200
commit80b96bc4a7350d3ef9971a5548b7e47a43aa7c90 (patch)
tree6500fb99c9f254b9127085daa6bd9f1463ef1f67
parent093eab56de543cb8cc6dc505de2b8d9f2af9e77b (diff)
downloadredis-80b96bc4a7350d3ef9971a5548b7e47a43aa7c90.tar.gz
Scripting test: check that Lua can call commands rewirting argv.
SPOP, tested in the new test, is among the commands rewritng the client->argv argument vector (it gets rewritten as SREM) for command replication purposes. Because of recent optimizations to client->argv caching in the context of the Lua internal Redis client, it is important to test for SPOP to be callable from Lua without bad effects to the other commands.
-rw-r--r--tests/unit/scripting.tcl15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/unit/scripting.tcl b/tests/unit/scripting.tcl
index a17892d30..dd3127e78 100644
--- a/tests/unit/scripting.tcl
+++ b/tests/unit/scripting.tcl
@@ -311,8 +311,21 @@ start_server {tags {"scripting"}} {
r config set slave-read-only yes
r slaveof 127.0.0.1 0
r debug loadaof
- r get foo
+ set res [r get foo]
+ r slaveof no one
+ set res
} {102}
+
+ test {We can call scripts rewriting client->argv from Lua} {
+ r del myset
+ r sadd myset a b c
+ r mset a 1 b 2 c 3 d 4
+ assert {[r spop myset] ne {}}
+ assert {[r spop myset] ne {}}
+ assert {[r spop myset] ne {}}
+ assert {[r mget a b c d] eq {1 2 3 4}}
+ assert {[r spop myset] eq {}}
+ }
}
# Start a new server since the last test in this stanza will kill the