From e7887e60609be05f4390c4671d910ff700705aae Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 26 Jun 2014 16:00:24 +0200 Subject: [PATCH] Test: hopefully more robust PSYNC test. This is supposed to fix issue #1417, but we'll know if this is enough only after a couple of runs of the CI test without false positives. --- tests/integration/replication-psync.tcl | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/integration/replication-psync.tcl b/tests/integration/replication-psync.tcl index 97d74db3..e0a4e542 100644 --- a/tests/integration/replication-psync.tcl +++ b/tests/integration/replication-psync.tcl @@ -29,15 +29,25 @@ proc test_psync {descr duration backlog_size backlog_ttl delay cond} { set load_handle1 [start_bg_complex_data $master_host $master_port 11 100000] set load_handle2 [start_bg_complex_data $master_host $master_port 12 100000] - test {First server should have role slave after SLAVEOF} { + test {Slave should be able to synchronize with the master} { $slave slaveof $master_host $master_port wait_for_condition 50 100 { - [s 0 role] eq {slave} + [lindex [r role] 0] eq {slave} && + [lindex [r role] 3] eq {connected} } else { fail "Replication not started." } } + # Check that the background clients are actually writing. + test {Detect write load to master} { + wait_for_condition 50 100 { + [$master dbsize] > 100 + } else { + fail "Can't detect write load from background clients." + } + } + test "Test replication partial resync: $descr" { # Now while the clients are writing data, break the maste-slave # link multiple times. @@ -92,8 +102,10 @@ test_psync {ok psync} 6 1000000 3600 0 { assert {[s -1 sync_partial_ok] > 0} } -test_psync {no backlog} 6 100 3600 0 { - assert {[s -1 sync_partial_err] > 0} +while 1 { + test_psync {no backlog} 6 100 3600 0.5 { + assert {[s -1 sync_partial_err] > 0} + } } test_psync {ok after delay} 3 100000000 3600 3 {