Access Sqlx Database within Test #2900
Unanswered
adamsdally
asked this question in
Questions
Replies: 1 comment
-
Depending on your needs, you may be better off creating an in-memory database for your test code. It uses the same sqlx client, so your code under test will work just fine. Since it's an in-memory database, it doesn't persist, which means you can modify it in any way you want while the test is running, and don't have to worry about rebuilding the database between tests. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm attempting to write some integration tests where I would like to access the sqlite database after visiting a route.
Below is the basics of my test setup.
Some things I have tried are accessing the database with sqlx directly, but the file is still locked. I would rather not have to switched databases to solve this. I also couldn't figure out a practical way of pulling it out of client, but hopefully I'm just overlooking something.
Beta Was this translation helpful? Give feedback.
All reactions