]> Untitled Git - lemmy.git/blob - scripts/test.sh
work around race condition on community fetch (#3414)
[lemmy.git] / scripts / test.sh
1 #!/usr/bin/env bash
2 set -e
3
4 CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
5
6 cd $CWD/../
7
8 PACKAGE="$1"
9 echo "$PACKAGE"
10
11 source scripts/start_dev_db.sh
12
13 # tests are executed in working directory crates/api (or similar),
14 # so to load the config we need to traverse to the repo root
15 export LEMMY_CONFIG_LOCATION=../../config/config.hjson
16 export RUST_BACKTRACE=1
17
18 if [ -n "$PACKAGE" ];
19 then
20   cargo test -p $PACKAGE --all-features --no-fail-fast
21 else
22   cargo test --workspace --no-fail-fast
23 fi
24
25 # Add this to do printlns: -- --nocapture
26
27 pg_ctl stop
28 rm -rf $PGDATA