diff options
author | Oran Agra <oran@redislabs.com> | 2021-03-30 11:41:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-30 11:41:06 +0300 |
commit | cd81dcf18bf9dafbe0edf29d9bba8c626cd2459e (patch) | |
tree | 38b42e996b2b9fb38a2116f4b3103bb478474491 /tests/integration/psync2-pingoff.tcl | |
parent | 65311a3360728dda9688ee7756db87cc2c9cb8b4 (diff) | |
download | redis-cd81dcf18bf9dafbe0edf29d9bba8c626cd2459e.tar.gz |
solve race conditions in psync2-pingoff test (#8720)
Another test race condition in the macos tests.
the test was waiting for PINGs to be generated and put on the replication stream,
but waiting for 1 or 2 seconds doesn't really guarantee that.
then the test that expected 6 full syncs, found only 4
Diffstat (limited to 'tests/integration/psync2-pingoff.tcl')
-rw-r--r-- | tests/integration/psync2-pingoff.tcl | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/integration/psync2-pingoff.tcl b/tests/integration/psync2-pingoff.tcl index cdecfc5c6..7744010a4 100644 --- a/tests/integration/psync2-pingoff.tcl +++ b/tests/integration/psync2-pingoff.tcl @@ -111,7 +111,13 @@ start_server {} { $replica1 replicaof no one $replica2 replicaof 127.0.0.1 1 ;# we can't promote it to master since that will cycle the replication id $master config set repl-ping-replica-period 1 - after 1500 + set replofs [status $master master_repl_offset] + wait_for_condition 50 100 { + [status $replica3 master_repl_offset] > $replofs && + [status $replica4 master_repl_offset] > $replofs + } else { + fail "replica didn't sync in time" + } # make everyone sync from the replica1 that didn't get the last ping from the old master # replica4 will keep syncing from the old master which now syncs from replica1 @@ -195,10 +201,16 @@ start_server {} { fail "Chained replica not replicating from its master" } - # Do a write on the master, and wait for 3 seconds for the master to + # Do a write on the master, and wait for the master to # send some PINGs to its replica $R(0) INCR counter2 - after 2000 + set replofs [status $R(0) master_repl_offset] + wait_for_condition 50 100 { + [status $R(1) master_repl_offset] > $replofs && + [status $R(2) master_repl_offset] > $replofs + } else { + fail "replica didn't sync in time" + } set sync_partial_master [status $R(0) sync_partial_ok] set sync_partial_replica [status $R(1) sync_partial_ok] $R(0) CONFIG SET repl-ping-replica-period 100 |