You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix test failures in test_sync_noflush_novote, take 2
The doTicks approach did not work well because it isn't very accurate and doesn't take into account the time spent outside of the actual ticking.
So this replaces it with a direct loop which compares against the current time to ensure that exactly the right amount of time has elapsed since the creation of the SyncObj.
This test may break again if the time spent inside SyncObj increases greatly; for example, if __init__ takes very long, the start time would not match the corresponding values inside the objects. Each individual tick may also not take too long.
# Specifically, o2 is expected to ignore the messages until 1.1 * timeout, i.e. including the one sent by o1 after 2.5 seconds, except for updating its term.
380
380
# Note that o1 has flushing enabled but o2 doesn't!
# While o1 converted to a follower at 2.4 due to o2's vote request, it still called for an election at 2.5 since the term change doesn't affect the election timeout.
439
+
# Therefore, o2 converted to a follower again at 2.5 due to the bigger term. However, o2 still didn't grant its vote to o1 since 1.1 * timeout (= 2.64) hasn't elapsed yet.
# o1 called for another election at 2.9 (it reset its timeout on o2's vote request at 2.4), i.e. after o2's vote block timeout, so it should now be elected.
448
+
# o1 called for another election at 3.0, i.e. after o2's vote block timeout, so it should now be elected.
0 commit comments