lemmy/scripts/test.sh
dullbananas 7d3894d5dd
Automatically manage database when running scripts/test.sh (#3389)
* Update .gitignore

* Create start-dev-db.sh

* Rename start-dev-db.sh to start_dev_db.sh

* Update .gitignore

* Update start_dev_db.sh

* Update start_dev_db.sh

* Update start_dev_db.sh

* Update start_dev_db.sh

* h

* Update test.sh

* Update start_dev_db.sh

* made it work

* Make test.sh work when run from scripts dir
2023-06-30 09:50:30 +02:00

29 lines
577 B
Bash
Executable file

#!/usr/bin/env bash
set -e
CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
cd $CWD/../
PACKAGE="$1"
echo "$PACKAGE"
source scripts/start_dev_db.sh
# 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
export RUST_BACKTRACE=1
if [ -n "$PACKAGE" ];
then
cargo test -p $PACKAGE --all-features --no-fail-fast
else
cargo test --workspace --no-fail-fast
fi
# Add this to do printlns: -- --nocapture
pg_ctl stop
rm -rf $PGDATA