Skip to content

Commit

Permalink
fail the test-example.sh if go test fail, but after post.sh got executed
Browse files Browse the repository at this point in the history
  • Loading branch information
lonegunmanb committed Mar 7, 2025
1 parent 951302e commit d81ce6a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion avm_scripts/test-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ fi
echo "==> go test"
echo $TEST_TIMEOUT
terraform version
go test -v -timeout=$TEST_TIMEOUT -run TestExample --
test_failed=false
go test -v -timeout=$TEST_TIMEOUT -run TestExample || test_failed=true

# change dir back into the example and run post.sh if it exists
cd "$AVM_MOD_PATH/examples/$AVM_EXAMPLE"
Expand All @@ -37,3 +38,8 @@ if [ -f post.sh ]; then
chmod +x ./post.sh
./post.sh
fi

if [ "$test_failed" = true ]; then
echo "==> Test failed"
exit 1
fi

0 comments on commit d81ce6a

Please sign in to comment.