From 2132cfbe593bec57f8f16ad62400a7643642ecf0 Mon Sep 17 00:00:00 2001 From: Youjung Kim <126618609+ykim-1@users.noreply.github.com> Date: Tue, 10 Oct 2023 07:49:36 -0700 Subject: [PATCH] Fix: mark execution as failed when there are failures (#531) --- .github/workflows/e2e-suite.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e-suite.yml b/.github/workflows/e2e-suite.yml index cdfa2425b..27f32a592 100644 --- a/.github/workflows/e2e-suite.yml +++ b/.github/workflows/e2e-suite.yml @@ -9,6 +9,8 @@ jobs: integration-tests: name: Run integration tests runs-on: ubuntu-latest + env: + EXIT_STATUS: 0 steps: - name: Clone Repository uses: actions/checkout@v3 @@ -39,9 +41,8 @@ jobs: run: | timestamp=$(date +'%Y%m%d%H%M') report_filename="${timestamp}_cli_test_report.xml" - status=0 if ! pytest tests/integration --disable-warnings --junitxml="${report_filename}"; then - echo "Tests failed, but attempting to upload results anyway" + echo "EXIT_STATUS=1" >> $GITHUB_ENV fi env: LINODE_CLI_TOKEN: ${{ secrets.LINODE_TOKEN }} @@ -67,4 +68,13 @@ jobs: env: LINODE_CLI_TOKEN: ${{ secrets.SHARED_DX_TOKEN }} LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }} - LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }} \ No newline at end of file + LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }} + + - name: Test Execution Status Handler + run: | + if [[ "$EXIT_STATUS" != 0 ]]; then + echo "Test execution contains failure(s)" + exit $EXIT_STATUS + else + echo "Tests passed!" + fi \ No newline at end of file