-
Notifications
You must be signed in to change notification settings - Fork 11
test(worker): Add tests for blocking_timeout behavior in LockManager #600
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
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #600 +/- ##
=======================================
Coverage 93.78% 93.78%
=======================================
Files 1291 1291
Lines 46907 46907
Branches 1517 1517
=======================================
Hits 43991 43991
Misses 2607 2607
Partials 309 309
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
thomasrockhu-codecov
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.
With all the comments, it's really difficult to understand what is going on in the tests, please update to make it human-readable
| blocking_timeouts = [] | ||
| lock_called = threading.Event() | ||
|
|
||
| def mock_lock(*args, **kwargs): |
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.
probably shouldn't be function in a function here and more of a helper
apps/worker/tasks/tests/unit/test_bundle_analysis_processor_task.py
Outdated
Show resolved
Hide resolved
- Introduced tests to verify that blocking_timeout=None causes indefinite blocking, preventing retry logic from functioning correctly. - Added a test to ensure that a valid blocking_timeout enables retry logic by raising LockError. - Updated BundleAnalysisProcessorTask tests to confirm that the default blocking_timeout is used, preventing indefinite blocking. - Adjusted assertions to reflect changes in retry logic and blocking_timeout handling.
- Removed nested helper functions in test_lock_manager.py - Used side_effect pattern instead of direct mock assignment - Simplified threading logic by using lambda in Thread target - Applied consistent mock patterns across both test files Addresses review comments from @thomasrockhu-codecov
c003019 to
3de8d26
Compare
Note
Strengthens test coverage around Redis lock acquisition and retry behavior.
LockManagertests showingblocking_timeout=Noneleads to indefinite blocking (noLockError) and that a finiteblocking_timeoutraisesLockErrorto triggerLockRetryBundleAnalysisProcessorTasktests to assert a non-Nonedefaultblocking_timeoutis used and that lock failures causeRetry(and returnprevious_resultwhen max retries/attempts are exceeded)Written by Cursor Bugbot for commit 3de8d26. This will update automatically on new commits. Configure here.