-
Notifications
You must be signed in to change notification settings - Fork 919
Fix panic in TestCollection. #2175
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
Fix panic in TestCollection. #2175
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 panic issue in TestCollection by replacing assert.Nil
calls with require.NoError
for error checking. The change ensures tests stop immediately when an unexpected error occurs, preventing subsequent code from attempting to access nil pointers and causing runtime panics.
- Replaces ~100 instances of
assert.Nil
withrequire.NoError
for MongoDB operation error handling - Maintains existing error message formatting for better debugging
- Prevents cascading failures that lead to nil pointer dereferences when accessing command monitoring results
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
🧪 Performance ResultsCommit SHA: a9af464The following benchmark tests for version 68a51018f463160007de09c2 had statistically significant changes (i.e., |z-score| > 1.96):
For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch. |
API Change ReportNo changes found! |
Summary
assert.Nil
for error checking withrequire.NoError
, so the test stops as soon as an unexpected error is returned.Background & Motivation
There's currently a panic while inspecting command monitoring results after an unexpected error happens: