[fix][test] Avoid spying an instance that contains volatile fields in ManagedLedgerTest.testLockReleaseWhenTrimLedger() test to avoid flaky test#24
Conversation
|
I occasionally found I was every confused since The The only inconsistent cause in code is here, we returns old I searched all the call chains to this method, and came out to a reason: there should be exactly one invocation of the Finally, I found that the root cause of the issue was the interaction between the spy and volatile fields. I'll explain in the following comments. |
11f50f9 to
d4e4a92
Compare







Motivation
Fix
ManagedLedgerTest.testLockReleaseWhenTrimLedger()flaky test.This test has the following problems:
assertEquals(ledger.ledgers.size() - 1, entries)orassertEquals(ledger.ledgerCache.size() - 1, entries - 1)may be flaky, see code comments.Modifications
Verifying this change
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: