From 28ccb53008eed402999d85aa0ac66714b9f5bd03 Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 26 Apr 2012 11:25:13 +0200 Subject: [PATCH] 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. --- tests/integration/replication.tcl | 7 +++++-- tests/support/test.tcl | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/integration/replication.tcl b/tests/integration/replication.tcl index 7c1edb55..3689181f 100644 --- a/tests/integration/replication.tcl +++ b/tests/integration/replication.tcl @@ -10,8 +10,11 @@ start_server {tags {"repl"}} { set rd [redis_deferring_client] $rd brpoplpush a b 5 r lpush a foo - after 1000 - assert_equal [r debug digest] [r -1 debug digest] + wait_for_condition 50 100 { + [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} { diff --git a/tests/support/test.tcl b/tests/support/test.tcl index 91ab8117..480c674e 100644 --- a/tests/support/test.tcl +++ b/tests/support/test.tcl @@ -53,7 +53,7 @@ proc assert_type {type key} { # executed. proc wait_for_condition {maxtries delay e _else_ elsescript} { while {[incr maxtries -1] >= 0} { - if {[uplevel 1 expr $e]} break + if {[uplevel 1 [list expr $e]]} break after $delay } if {$maxtries == -1} { -- 2.45.2