2023-01-12 18:23:58 -05:00
|
|
|
#!/bin/bash
|
2023-01-20 12:43:23 -05:00
|
|
|
set -e
|
2023-01-12 18:23:58 -05:00
|
|
|
|
|
|
|
PACKAGE="$1"
|
|
|
|
echo "$PACKAGE"
|
2020-12-11 09:56:20 -05:00
|
|
|
|
2021-02-04 11:34:58 -05:00
|
|
|
psql -U lemmy -d postgres -c "DROP DATABASE lemmy;"
|
|
|
|
psql -U lemmy -d postgres -c "CREATE DATABASE lemmy;"
|
|
|
|
|
2020-07-10 14:16:42 -04:00
|
|
|
export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy
|
2021-04-05 13:21:56 -04:00
|
|
|
# tests are executed in working directory crates/api (or similar),
|
|
|
|
# so to load the config we need to traverse to the repo root
|
|
|
|
export LEMMY_CONFIG_LOCATION=../../config/config.hjson
|
2023-01-12 18:23:58 -05:00
|
|
|
export RUST_BACKTRACE=1
|
|
|
|
|
|
|
|
if [ -n "$PACKAGE" ];
|
|
|
|
then
|
|
|
|
cargo test -p $PACKAGE --all-features --no-fail-fast
|
|
|
|
else
|
2023-01-30 14:17:24 -05:00
|
|
|
cargo test --workspace --no-fail-fast
|
2023-01-12 18:23:58 -05:00
|
|
|
fi
|
|
|
|
|
2022-07-29 23:55:59 -04:00
|
|
|
# Add this to do printlns: -- --nocapture
|