diff options
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/replication-4.tcl | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/tests/integration/replication-4.tcl b/tests/integration/replication-4.tcl index 9f4281f7c..d7a8b92a6 100644 --- a/tests/integration/replication-4.tcl +++ b/tests/integration/replication-4.tcl @@ -122,19 +122,35 @@ start_server {tags {"repl external:skip"}} { } test {Replication of an expired key does not delete the expired key} { + # This test is very likely to do a false positive if the wait_for_ofs_sync + # takes longer than the expiration time, so give it a few more chances. + # Go with 5 retries of increasing timeout, i.e. start with 500ms, then go + # to 1000ms, 2000ms, 4000ms, 8000ms. + set px_ms 500 + for {set i 0} {$i < 5} {incr i} { + + wait_for_ofs_sync $master $slave $master debug set-active-expire 0 - $master set k 1 ex 1 + $master set k 1 px $px_ms wait_for_ofs_sync $master $slave exec kill -SIGSTOP [srv 0 pid] $master incr k - after 1001 + after [expr $px_ms + 1] # Stopping the replica for one second to makes sure the INCR arrives # to the replica after the key is logically expired. exec kill -SIGCONT [srv 0 pid] wait_for_ofs_sync $master $slave # Check that k is logically expired but is present in the replica. - assert_equal 0 [$slave exists k] - $slave debug object k ; # Raises exception if k is gone. + set res [$slave exists k] + set errcode [catch {$slave debug object k} err] ; # Raises exception if k is gone. + if {$res == 0 && $errcode == 0} { break } + set px_ms [expr $px_ms * 2] + + } ;# for + + if {$::verbose} { puts "Replication of an expired key does not delete the expired key test attempts: $i" } + assert_equal $res 0 + assert_equal $errcode 0 } } } |