Note: The
DATABASE_URL
must be present as environment variable for the database tests. TheDATABASE_URL
is automatically set using thebuild.rs
file if the build is not a release build.
Running all tests
cargo test
Running tests for a specific workspace member
cargo test -p item_producer
Note:
npm run sqlx:prepare
runs thesrcs/scripts/sqlx_prepare.sh
script, which by default runscargo sqlx prepare
on all crates individually. Available options areall
,item_producer
,user_service
, andtauri
.
The docker images do not have access to a database with migrations applied during build-time. To ensure the docker image can be built, the json files under the .sqlx
directory must be up-to-date and committed.
The following script automatically sets-up each database and applies migrations using the build.rs
config defined within each crate and then prepares the .sqlx
cache directory.
docker compose up -d
npm run sqlx:prepare