staticaddr: deflake deposit manager test#1111
staticaddr: deflake deposit manager test#1111starius wants to merge 1 commit intolightninglabs:masterfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses flaky test failures in the deposit manager by refactoring the test suite to rely on stable, observable effects rather than internal implementation details. By introducing per-test context management and replacing shared global channels with localized ones, the changes ensure that tests are isolated and deterministic, effectively resolving race conditions that were previously triggered under high-concurrency test environments. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors TestManager in staticaddr/deposit/manager_test.go by migrating global test channels into a local context and improving test synchronization with timeouts and context-based cancellation. The review feedback highlights potential deadlocks during the manager's initialization and shutdown phases, and suggests using more robust timeout handling to avoid flakiness in CI environments.
The sqlite and postgres race jobs were both hanging in deposit.TestManager. The test was observing the manager through implementation details that were not safe to share with the manager itself: - it replaced the manager's internal finalizedDepositChan and then waited on the same channel the manager consumes - it reused package-level block and confirmation channels across runs - it treated confirmationHeight+expiry as the last pre-expiry block even though the production IsExpired check uses >= - it relied on scheduler timing when asserting that no sign request had happened yet Make the test assert on stable effects instead of internal channel ownership: - create per-test notifier channels in the test context - run the manager from a cancellable t.Context-derived context and assert clean shutdown - send the actual last pre-expiry height, then the expiry height - wait for the expiry sign and publish steps with bounded timeouts - verify finalization by waiting for the manager to remove the deposit from activeDeposits instead of racing its private finalization channel This keeps the test aligned with the production expiry semantics and removes the race that only showed up reliably under -race.
67f6f30 to
3c49d7c
Compare
The sqlite and postgres race jobs were both hanging in deposit.TestManager. The test was observing the manager through implementation details that were not safe to share with the manager itself:
Make the test assert on stable effects instead of internal channel ownership:
This keeps the test aligned with the production expiry semantics and removes the race that only showed up reliably under -race.
Pull Request Checklist
release_notes.mdif your PR contains major features, breaking changes or bugfixes