From 2981d160a341c873ad148459d2344d9c2968942c Mon Sep 17 00:00:00 2001 From: Haris <4259838+Wulf@users.noreply.github.com> Date: Wed, 1 Nov 2023 20:10:10 -0400 Subject: [PATCH] Pipeline should fail if a test fails --- test/simple_table/test.sh | 2 +- test/test_all.sh | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/test/simple_table/test.sh b/test/simple_table/test.sh index acf5dbde..c0b72d45 100755 --- a/test/simple_table/test.sh +++ b/test/simple_table/test.sh @@ -4,4 +4,4 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" cd $SCRIPT_DIR -cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" \ No newline at end of file +cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection>" diff --git a/test/test_all.sh b/test/test_all.sh index 21a8029b..7958d38e 100755 --- a/test/test_all.sh +++ b/test/test_all.sh @@ -10,8 +10,19 @@ cd $SCRIPT_DIR for D in *; do if [ -d "${D}" ]; then echo "Testing $D" - ${D}/test.sh + + # check if next script returns an error + if ! ./$D/test.sh; then + echo "Test '$D' failed" + + ERROR=1 + fi + # output separator echo "" fi done + +if [ "$ERROR" == "1" ]; then + exit 1 +fi \ No newline at end of file