generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Default to panicking if a test accesses a real db #1460
Comments
Open
How would we do this? |
|
Sounds like a good idea to me. |
matt2e
added a commit
that referenced
this issue
May 10, 2024
fixes #1460 Issue says to panic, but in the end I just returned an error Example error message: > accessing non-test database "oidcauth" while testing: try adding ftltest.WithDatabase(db) as an option with ftltest.Context(...)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We now have
ftltest.WithDatabase(...)
which switches the DSN to a<name>_test
db (and wipes the db tables).It can be hard to tell when writing tests if a real db is accidentally being used.
example: I'm trying to move pfi tests to use test dbs but it's pretty opaque without looking through each package carefully.
If there is a legitimate usecase for touching db's that havent been swapped with
ftltest.WithDatabase
we could add a option to allow it?Thoughts?
The text was updated successfully, but these errors were encountered: