summaryrefslogtreecommitdiff
path: root/tests/integration/replication-psync.tcl
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-06-26 16:00:24 +0200
committerantirez <antirez@gmail.com>2014-06-26 16:00:27 +0200
commite7887e60609be05f4390c4671d910ff700705aae (patch)
treed852945ce16a48efe5fd818d70cc06ec20ff71f5 /tests/integration/replication-psync.tcl
parentf86798ba6b3a0fb34109c55141c18997b55266b6 (diff)
downloadredis-e7887e60609be05f4390c4671d910ff700705aae.tar.gz
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.
Diffstat (limited to 'tests/integration/replication-psync.tcl')
-rw-r--r--tests/integration/replication-psync.tcl20
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/integration/replication-psync.tcl b/tests/integration/replication-psync.tcl
index 97d74db37..e0a4e5429 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 {