-
Notifications
You must be signed in to change notification settings - Fork 524
P20-1549: Fix User.find_channel_owner test
#70170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a flaky test that was timing out by refactoring the storage ID management approach. Instead of manually creating and cleaning up storage IDs, the code now uses database transactions with automatic rollback to ensure proper cleanup and prevent database contention.
Key Changes:
- Replaced manual storage ID lifecycle management with transactional approach using
rollback: :always - Re-enabled previously skipped flaky test
find_channel_owner returns nil for channel with no owner
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| dashboard/test/testing/projects_test_utils.rb | Refactored with_storage_id_for to use database transactions with automatic rollback instead of manual cleanup |
| dashboard/test/models/user_test.rb | Removed skip statement to re-enable the previously flaky test |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
To use Codex here, create a Codex account and connect to github. |
davidsbailey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Artem, nice work tracking this down! While the passing drone runs are convincing, I'm not sure I understand what exactly the problem was and why the new code is better. can you help me understand the fix? additionally, is there a test case you could add for with_storage_id_for that would help clarify what the issue was and make sure we don't regress?
davidsbailey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@artem-vavilov apologies but please ignore the requests in my previous comment. after reading copilot's summary, I'm convinced that you're doing this the right way and that no one is going to try to undo it, and it doesn't need unit tests just to prove a db transaction is working. LGTM
Not entirely sure what the root cause was. The Sequel request executed inside with_storage_id_for would occasionally time out and fail. I addressed this by wrapping the logic in a transaction and always rolling it back. This avoids committing any new records and immediately reverts the changes, instead of issuing a separate DELETE, which should be more efficient and safer under contention. |
Issue
Links