Skip to content

Commit

Permalink
Handle skipping final step in E2E tests (#516)
Browse files Browse the repository at this point in the history
* Handle skipping final step

* force test failure to test workflow

* shorter verdict evaluation

* removed forced failure

* example invocation corrected
  • Loading branch information
jaroslaw-pieszka authored Nov 30, 2023
1 parent 37457ac commit 319ba6c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/run-e2e-tests-reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,23 @@ jobs:
- name: Run tests
run: "./scripts/testing/run_e2e_module_tests.sh ${{ inputs.credentials-mode }} ci"

finish-e2e-tests:
confirm-matrix-tests-succeeded:
runs-on: ubuntu-latest
needs: run-e2e-matrix
if: success()
outputs:
success: ${{ steps.set-output.outputs.success }}
steps:
- name: Final step
run: echo "All finished"
- name: Confirm that matrix tests succeeded
id: set-output
run: echo "success=true" >> "${GITHUB_OUTPUT}"

finish-e2e-tests:
runs-on: ubuntu-latest
needs: confirm-matrix-tests-succeeded
if: always()
steps:
- name: Final decision
run: |
[[ "${{ needs.confirm-matrix-tests-succeeded.outputs.success }}" != "true" ]] && echo "E2E tests failed" && exit 1
echo "E2E tests passed"
5 changes: 1 addition & 4 deletions scripts/testing/run_e2e_module_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
# - credentials mode, allowed values (required):
# dummy - dummy credentials passed
# real - real credentials passed
# - ci to indicate call from CI pipeline (optional)
# ./run_e2e_module_tests.sh real ci
# ./run_e2e_module_tests.sh real
#
# The script requires the following environment variable set - these values are used to create unique SI and SB names:
# GITHUB_RUN_ID - a unique number for each workflow run within a repository
Expand All @@ -17,8 +16,6 @@
# SM_URL - service manager url
# SM_TOKEN_URL - token url

CI=${2-manual} # if called from any workflow "ci" is expected here

# standard bash error handling
set -o nounset # treat unset variables as an error and exit immediately.
set -o errexit # exit immediately when a command fails.
Expand Down

0 comments on commit 319ba6c

Please sign in to comment.