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.
This commit is contained in:
antirez 2014-06-26 16:00:24 +02:00
parent f86798ba6b
commit e7887e6060

View File

@ -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 {