Commit 28ccb530 authored by antirez's avatar antirez
Browse files

Redis test: More reliable BRPOPLPUSH replication test.

Now it uses the new wait_for_condition testing primitive.
Also wait_for_condition implementation was fixed in this commit to properly
escape the expr command and its argument.
parent 57356b80
...@@ -10,8 +10,11 @@ start_server {tags {"repl"}} { ...@@ -10,8 +10,11 @@ start_server {tags {"repl"}} {
set rd [redis_deferring_client] set rd [redis_deferring_client]
$rd brpoplpush a b 5 $rd brpoplpush a b 5
r lpush a foo r lpush a foo
after 1000 wait_for_condition 50 100 {
assert_equal [r debug digest] [r -1 debug digest] [r debug digest] eq [r -1 debug digest]
} else {
fail "Master and slave have different digest: [r debug digest] VS [r -1 debug digest]"
}
} }
test {BRPOPLPUSH replication, list exists} { test {BRPOPLPUSH replication, list exists} {
......
...@@ -53,7 +53,7 @@ proc assert_type {type key} { ...@@ -53,7 +53,7 @@ proc assert_type {type key} {
# executed. # executed.
proc wait_for_condition {maxtries delay e _else_ elsescript} { proc wait_for_condition {maxtries delay e _else_ elsescript} {
while {[incr maxtries -1] >= 0} { while {[incr maxtries -1] >= 0} {
if {[uplevel 1 expr $e]} break if {[uplevel 1 [list expr $e]]} break
after $delay after $delay
} }
if {$maxtries == -1} { if {$maxtries == -1} {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment