EVAL replication test: less false positives.

wait_for_condition is now used instead of the usual "after 1000" (that
is the way to sleep in Tcl). This should avoid to find the replica in
a state where it is loading the RDB in memory, returning -LOADING error.

This test used to fail when running the test over valgrind, due to the
added latencies.
This commit is contained in:
antirez 2012-06-02 23:29:57 +02:00
parent 51857c7e5c
commit 80e808b6d6
2 changed files with 8 additions and 4 deletions

View File

@ -83,7 +83,7 @@ proc waitForBgrewriteaof r {
proc wait_for_sync r {
while 1 {
if {[status r master_link_status] eq "down"} {
if {[status $r master_link_status] eq "down"} {
after 10
} else {
break

View File

@ -319,9 +319,13 @@ start_server {tags {"scripting repl"}} {
test {Connect a slave to the main instance} {
r -1 slaveof [srv 0 host] [srv 0 port]
after 1000
s -1 role
} {slave}
wait_for_condition 50 100 {
[s -1 role] eq {slave} &&
[string match {*master_link_status:up*} [r -1 info replication]]
} else {
fail "Can't turn the instance into a slave"
}
}
test {Now use EVALSHA against the master} {
r evalsha ae3477e27be955de7e1bc9adfdca626b478d3cb2 0