2023-06-08 15:38:26 -04:00
|
|
|
#!/usr/bin/env bash
|
2023-01-20 12:43:23 -05:00
|
|
|
set -e
|
2023-01-12 18:23:58 -05:00
|
|
|
|
2023-06-30 03:50:30 -04:00
|
|
|
CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
|
|
|
|
|
2024-08-22 11:33:00 -04:00
|
|
|
cd "$CWD/../"
|
2023-06-30 03:50:30 -04:00
|
|
|
|
2023-01-12 18:23:58 -05:00
|
|
|
PACKAGE="$1"
|
2024-04-09 19:33:01 -04:00
|
|
|
TEST="$2"
|
2020-12-11 09:56:20 -05:00
|
|
|
|
2023-06-30 03:50:30 -04:00
|
|
|
source scripts/start_dev_db.sh
|
2021-02-04 11:34:58 -05:00
|
|
|
|
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
|
2024-07-21 11:50:50 -04:00
|
|
|
export LEMMY_TEST_FAST_FEDERATION=1 # by default, the persistent federation queue has delays in the scale of 30s-5min
|
2023-01-12 18:23:58 -05:00
|
|
|
|
|
|
|
if [ -n "$PACKAGE" ];
|
|
|
|
then
|
2024-04-09 19:33:01 -04:00
|
|
|
cargo test -p $PACKAGE --all-features --no-fail-fast $TEST
|
2023-01-12 18:23:58 -05:00
|
|
|
else
|
2023-01-30 14:17:24 -05:00
|
|
|
cargo test --workspace --no-fail-fast
|
2024-05-27 09:34:58 -04:00
|
|
|
# Testing lemmy utils all features in particular (for ts-rs bindings)
|
|
|
|
cargo test -p lemmy_utils --all-features --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
|
2023-06-30 03:50:30 -04:00
|
|
|
|
2024-01-24 10:22:33 -05:00
|
|
|
pg_ctl stop --silent
|
2023-06-30 03:50:30 -04:00
|
|
|
rm -rf $PGDATA
|