-
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 missing tests for the sqltypes package #15056
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
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #15056 +/- ##
==========================================
+ Coverage 47.72% 47.76% +0.03%
==========================================
Files 1155 1155
Lines 240264 240264
==========================================
+ Hits 114665 114754 +89
+ Misses 116996 116919 -77
+ Partials 8603 8591 -12 ☔ View full report in Codecov by Sentry. |
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.
Rest LGTM. Just one minor change required
go/sqltypes/named_result_test.go
Outdated
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
val, err := row.ToInt(tt.fieldName) | ||
if val == 0 { |
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.
The check for whether there should be an error or not, shouldn't be defined by the result from the function you're testing. It should be inferred from the test configuration. So, instead we should use if tt.expectedErr != ""
. This same comment stands for subsequent checks as well.
fe56725
to
def7451
Compare
go/sqltypes/named_result_test.go
Outdated
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
_, err := row.ToInt(tt.fieldName) | ||
if tt.expectedInt == 0 { |
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.
Same here, we should be checking tt.expectedErr
instead. Like what if the value really is 0
for example?
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.
Right, it makes more sense to check using expectedErr. Thanks for pointing this out. I've updated the code.
Signed-off-by: VaibhavMalik4187 <[email protected]>
def7451
to
f06b63c
Compare
Description
This commit increases the code coverage of the
go/sqltypes
package to 62%.Related Issue(s)
Partially addresses: #14931
Checklist