-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Added unit tests for the constants/sidecar package #15044
Added unit tests for the constants/sidecar package #15044
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
@GuptaManan100, could you please review this PR whenever you have a moment? Thanks! |
6769a25
to
fd14f1b
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #15044 +/- ##
==========================================
- Coverage 47.65% 47.64% -0.01%
==========================================
Files 1151 1153 +2
Lines 239762 239773 +11
==========================================
- Hits 114251 114245 -6
- Misses 116907 116924 +17
Partials 8604 8604 ☔ View full report in Codecov by Sentry. |
I don't think adding tests for this is useful in any way. It merely adds overhead by now having to change these twice if we have to. |
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.
Thanks, @VaibhavMalik4187 ! While I don't necessarily disagree with @dbussink, this does prevent us from accidentally changing the default (unlikely, but still) and if we do then it's not difficult to find and change this other location.
Now that I think about what @dbussink, it makes sense. However, I didn't pay much attention to these details when I wrote the tests. I was going through the codebase and was looking for packages lacking in tests, and that's when I thought of raising this small PR. Thanks for reviewing this. |
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.
Whenever we change the global state in a test, we should ensure we set it back in a defer function call.
So, we should add this code to the test -
originalName := GetName()
defer func() {
SetName(originalName)
}()
This commit increases the code coverage of the `go/constants` package to 100% Partially addresses: vitessio#14931 Signed-off-by: VaibhavMalik4187 <[email protected]>
fd14f1b
to
4b81cb9
Compare
Understood, fixed in the latest version. |
After recent discussion, we have decided not to merge tests that we don't find useful. |
Description
This commit increases the code coverage of the
go/constants
package to 100%Related Issue(s)
Partially addresses: #14931
Checklist