-
Notifications
You must be signed in to change notification settings - Fork 964
test: add an ergonomic way to access the test database for debugging #19371
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
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.
I'd like to better understand how this is to be used. For instance, if you have a quick test I think it's unlikely you'll have time to connect to the database, right?
Why do you need to connect to the live database? There's also the dump database on failure option that can be enabled, which gives you the state of the database when it failed. That isn't sufficient for your use-case?
Is the purpose explicitly to allow outputting the DSN without modifying the test (i.e. not needing to add the option to output it and/or dump the db)?
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.
What's the expected flow here? Let's say you have an existing test that fails. I would imagine it would make sense to log the DSN and then wait for the user to continue once they've successfully connected.
Expected flow:
Dumping the database on test failure is useful, but still requires more friction than this in my opinion. |
Thanks @SasSwart, I think using dlv was the context I was missing, makes much more sense now 👍🏻. (PS. I think your commit didn't get pushed, or GitHub hasn't updated yet |
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.
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.
Thanks, great addition 👍🏻
Accessing the database during debugging currently requires either spinning up a separate PostgreSQL instance or inspecting memory to retrieve the DSN—both of which add unnecessary friction. While the test suite already provisions a database by default, connecting to it for manual inspection or debugging is not straightforward.
This change introduces a clearer and more accessible way to surface the DSN during debugging sessions, allowing developers to connect to the test database directly without relying on external infrastructure or ad hoc methods.
Expected Usage: