Skip to content
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

Implement adapter Name and add Name constant #85

Merged
merged 5 commits into from
Nov 6, 2023

Conversation

lafriks
Copy link
Contributor

@lafriks lafriks commented Oct 16, 2023

No description provided.

@lafriks lafriks force-pushed the feat/adapter_dbtype branch from d315d7d to c659aa2 Compare October 16, 2023 10:08
@lafriks lafriks added the enhancement New feature or request label Oct 16, 2023
@lafriks lafriks requested a review from Fs02 October 16, 2023 10:16
@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a660059) 82.81% compared to head (2362f6d) 83.45%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #85      +/-   ##
==========================================
+ Coverage   82.81%   83.45%   +0.64%     
==========================================
  Files           1        1              
  Lines         128      133       +5     
==========================================
+ Hits          106      111       +5     
  Misses         19       19              
  Partials        3        3              
Files Coverage Δ
mssql.go 83.45% <100.00%> (+0.64%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Fs02
Copy link
Member

Fs02 commented Oct 21, 2023

can you fix the code coverage?

@lafriks
Copy link
Contributor Author

lafriks commented Oct 21, 2023

not really as it won't anyway correctly cover that case then, I can remove MustOpen :)

@Fs02
Copy link
Member

Fs02 commented Oct 21, 2023

you can do unit test trick like extracting the panic checking code
it's easier to maintain 100% coverage than just letting it drops

@lafriks
Copy link
Contributor Author

lafriks commented Oct 21, 2023

I don't see reason to simulate code coverage percentage when actual case is not really checked

@Fs02
Copy link
Member

Fs02 commented Oct 22, 2023

it's to maintain code coverage
easier to enforce 100% code coverage policy than allowing coverage to be dropped case by case

what we do here is unit test, so IMO it's acceptable to do that, in fact we should make the code unit testable and sometimes it's required repeated refactoring

we must do actual case test when we are responsible for the logic, but for opening connection and etc, it's implemented by driver (and they are responsible for it) so it's okay to just simulate it

@Fs02
Copy link
Member

Fs02 commented Oct 22, 2023

IMO, this is not much different than when we mock functions to do unit test

@lafriks
Copy link
Contributor Author

lafriks commented Nov 5, 2023

Fixed it a bit different by mocking db.Open and this way actually kind a testing that code path

Copy link
Member

@Fs02 Fs02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks
I really appreciate this

@Fs02 Fs02 merged commit b0ee9c5 into go-rel:main Nov 6, 2023
@lafriks lafriks deleted the feat/adapter_dbtype branch November 6, 2023 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants