-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 ping logic for SQL Registry #3095
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3095 +/- ##
==========================================
- Coverage 79.70% 79.53% -0.17%
==========================================
Files 112 112
Lines 7932 7971 +39
==========================================
+ Hits 6322 6340 +18
- Misses 1213 1225 +12
- Partials 397 406 +9
Continue to review full report at Codecov.
|
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.
We will also need some tests for Janitor to make sure it does in fact throw an error on an incorrect DSN.
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.
Thank you!
Can you please take a look at the failing tests? https://github.com/ory/hydra/runs/6194460310?check_suite_focus=true#step:12:27 |
driver/registry_sql_test.go
Outdated
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
_ "github.com/mattn/go-sqlite3" |
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.
Is this really needed?
Hey @ludydoo Thank you for taking the time to work on this - I think we can almost merge this :) The PR just needs to address the following issues first:
|
I have been analyzing this piece a little bit. Let me share my thoughts here: One of the initial challenges I faced with this bit is around the It got me a bit confused at first. Especially because the So there is the indirection from The second suggestion I would have would be around either the naming or the purpose of The third, and perhaps the most impactful thing I have noticed, is around the I think that mocking the Review the naming of the dbal packageThe Introduce a
|
Hey @ludydoo Thank you for looking into this so extensively :) The issues you have raised are quite valid and I do think it does make sense to have a refactor that makes the code base a bit easier to read. However, this would be a big undertaking since it would also impact Keto and Kratos since they also use the I think for this PR we should focus on getting the current failing tests passing so we can merge it ;) |
@Benehiko sounds good. The issue with the provided example is that it creates a mock using
so that
Because of this, we cannot mock the The only way I see would be to either
What would be your recommended approach ? |
Hey @ludydoo Ah i see, yes you are correct. I think the easiest would be to construct a new function called We could then easily mock the |
Added a field on the RegistrySQL to be able to inject a method that will perform the initial pinging logic to the database.
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.
Very nice! :)
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.
Very nice 👍
Fixes the Ping logic on the SQL registry
Related issue(s)
#2734
Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security. vulnerability, I
confirm that I got green light (please contact
[email protected]) from the maintainers to push
the changes.
works.
Further Comments