summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2012-06-02 23:29:57 +0200
committerantirez <antirez@gmail.com>2012-06-02 23:32:01 +0200
commit3f12656781b883316c5e1a1375869fec1dea05a2 (patch)
treed54640c805adb4c7190279841e30f8505942bf97
parent591c9e6543d4474bd74921fbd15f110fa603b7b6 (diff)
downloadredis-3f12656781b883316c5e1a1375869fec1dea05a2.tar.gz
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.
-rw-r--r--tests/support/util.tcl2
-rw-r--r--tests/unit/scripting.tcl10
2 files changed, 8 insertions, 4 deletions
diff --git a/tests/support/util.tcl b/tests/support/util.tcl
index a2a9f8513..96af279d8 100644
--- a/tests/support/util.tcl
+++ b/tests/support/util.tcl
@@ -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
diff --git a/tests/unit/scripting.tcl b/tests/unit/scripting.tcl
index daf0c0f26..ec6e5c2a6 100644
--- a/tests/unit/scripting.tcl
+++ b/tests/unit/scripting.tcl
@@ -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