mirror of
https://github.com/fluencelabs/redis
synced 2025-04-01 15:21:03 +00:00
Scripting: execute tests with command replication as well.
This commit is contained in:
parent
ff6d296000
commit
073a42b997
@ -521,9 +521,17 @@ start_server {tags {"scripting"}} {
|
||||
}
|
||||
}
|
||||
|
||||
foreach cmdrepl {0 1} {
|
||||
start_server {tags {"scripting repl"}} {
|
||||
start_server {} {
|
||||
test {Before the slave connects we issue two EVAL commands} {
|
||||
if {$cmdrepl == 1} {
|
||||
set rt "(commmands replication)"
|
||||
} else {
|
||||
set rt "(scripts replication)"
|
||||
r debug lua-always-replicate-commands 1
|
||||
}
|
||||
|
||||
test "Before the slave connects we issue two EVAL commands $rt" {
|
||||
# One with an error, but still executing a command.
|
||||
# SHA is: 67164fc43fa971f76fd1aaeeaf60c1c178d25876
|
||||
catch {
|
||||
@ -534,7 +542,7 @@ start_server {tags {"scripting repl"}} {
|
||||
r eval {return redis.call('incr',KEYS[1])} 1 x
|
||||
} {2}
|
||||
|
||||
test {Connect a slave to the main instance} {
|
||||
test "Connect a slave to the main instance $rt" {
|
||||
r -1 slaveof [srv 0 host] [srv 0 port]
|
||||
wait_for_condition 50 100 {
|
||||
[s -1 role] eq {slave} &&
|
||||
@ -544,7 +552,7 @@ start_server {tags {"scripting repl"}} {
|
||||
}
|
||||
}
|
||||
|
||||
test {Now use EVALSHA against the master, with both SHAs} {
|
||||
test "Now use EVALSHA against the master, with both SHAs $rt" {
|
||||
# The server should replicate successful and unsuccessful
|
||||
# commands as EVAL instead of EVALSHA.
|
||||
catch {
|
||||
@ -553,7 +561,7 @@ start_server {tags {"scripting repl"}} {
|
||||
r evalsha 6f5ade10a69975e903c6d07b10ea44c6382381a5 1 x
|
||||
} {4}
|
||||
|
||||
test {If EVALSHA was replicated as EVAL, 'x' should be '4'} {
|
||||
test "If EVALSHA was replicated as EVAL, 'x' should be '4' $rt" {
|
||||
wait_for_condition 50 100 {
|
||||
[r -1 get x] eq {4}
|
||||
} else {
|
||||
@ -561,7 +569,7 @@ start_server {tags {"scripting repl"}} {
|
||||
}
|
||||
}
|
||||
|
||||
test {Replication of script multiple pushes to list with BLPOP} {
|
||||
test "Replication of script multiple pushes to list with BLPOP $rt" {
|
||||
set rd [redis_deferring_client]
|
||||
$rd brpop a 0
|
||||
r eval {
|
||||
@ -578,7 +586,7 @@ start_server {tags {"scripting repl"}} {
|
||||
set res
|
||||
} {a 1}
|
||||
|
||||
test {EVALSHA replication when first call is readonly} {
|
||||
test "EVALSHA replication when first call is readonly $rt" {
|
||||
r del x
|
||||
r eval {if tonumber(ARGV[1]) > 0 then redis.call('incr', KEYS[1]) end} 1 x 0
|
||||
r evalsha 6e0e2745aa546d0b50b801a20983b70710aef3ce 1 x 0
|
||||
@ -590,7 +598,7 @@ start_server {tags {"scripting repl"}} {
|
||||
}
|
||||
}
|
||||
|
||||
test {Lua scripts using SELECT are replicated correctly} {
|
||||
test "Lua scripts using SELECT are replicated correctly $rt" {
|
||||
r eval {
|
||||
redis.call("set","foo1","bar1")
|
||||
redis.call("select","10")
|
||||
@ -613,3 +621,4 @@ start_server {tags {"scripting repl"}} {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user