mvcc: Deflake TestWatchVictims with synctime - #22269
Conversation
|
Hi @Hrishi-Baskaran. Thanks for your PR. I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Hrishi-Baskaran The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Uses the synctest package to deterministicly test concurrent code that relies on time. Replaced the 10s timeout for Watch operations for a less flaky deadlock detector goroutine inside of a synctest bubble. Signed-off-by: Hrishi Baskaran <hrishithevar@gmail.com>
0766ab6 to
4d6a3b0
Compare
TestWatchVictimsTestWatchVictims with synctime
TestWatchVictims with synctimeTestWatchVictims with synctime
|
/assign @serathius |
Resolves #22266
Uses the
synctestpackage to remove nondeterminism from theTestWatchVictims. The main issue withTestWatchVictimswas the use of a wall clock 10 second timeout on Watch operations as a naive deadlock detection mechanism. On slow CI machines this may not be enough, on fast CI machines this may be too long, slowing down the test. I was able to replicate this with stress(see log with more context in the issue)
This PR replaced the above mechanism with a more deterministic one by running relevant code in a
synctestbubble which can halt or advance time arbitrarily depending on the current state of the synctest bubble.The end result is a test that will quickly detect a deadlock on a fast machine but will not report a deadlock if goroutines are advancing, even on a slow machine.
This also helps enforce the goal of the test that Puts should happen faster than Watch events by back pressuring Watch events with simulated time. This was previously done with wall clock time which is not as reliable and can slow down fast CI machines.
The overall changes improve both determinism and performance of this test.