Open Zizico2 opened 3 weeks ago
I would also like to use test containers with my SQLx code, so being able to define a fixture to set up the environment before running each test would be great.
This seems to be a duplicate of #3022.
I guess not exactly since I propose the direct integration of test-containers
Describe the solution you'd like Have
#[sqlx::test]
manage the full lifecycle of the test DB. Currently I'm running my tests usingtest-containers
, so I don't need any externally setup DB. Would this be something that could be incorporated intoSQLx
itself? Currently I'm using regular#[tokio::test]
.Describe alternatives you've considered Have some way to run a
setup
function, before whatever#[sqlx::test]
is doing. This way I could setup the container and maybe set theDATABASE_URL
environment variable. It could look like#[sqlx::test(setup=my_setup_function)]
.