Skip to content

E2E Tests

E2E Tests #15

Workflow file for this run

name: E2E Tests
on:
workflow_dispatch:
inputs:
commit_sha:
description: 'The hash value of the commit.'
required: true
push:
branches:
- main
- dev
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
if: ${{ inputs.commit_sha != '' }}
with:
ref: ${{ inputs.commit_sha }}
- name: checkout repo
uses: actions/checkout@v4
if: ${{ inputs.commit_sha == '' }}
- name: update packages
run: sudo apt-get update -y
- name: setup python 3
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: install or update Python build system
run: python3 -m pip install -U wheel setuptools certifi pip
- name: install test dependencies
run: make test-deps
- name: generate local SSH key
run: ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N ""
- name: run e2e test
run: |
timestamp=$(date +'%Y%m%d%H%M')
report_filename="${timestamp}_go_meta_test_report.xml"
if ! make e2e | go-junit-report -set-exit-code > "$report_filename"; then
echo "EXIT_STATUS=1" >> $GITHUB_ENV
fi
cat "$report_filename"
env:
CLEANUP_TEST_LINODE_INSTANCE: true
LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}
- name: Add additional information to XML report
run: |
filename=$(ls | grep -E '^[0-9]{12}_go_meta_test_report\.xml$')
python tod_scripts/add_to_xml_test_report.py \
--branch_name "${GITHUB_REF#refs/*/}" \
--gha_run_id "$GITHUB_RUN_ID" \
--gha_run_number "$GITHUB_RUN_NUMBER" \
--xmlfile "${filename}"
- name: Upload test results to bucket
run: |
report_filename=$(ls | grep -E '^[0-9]{12}_go_meta_test_report\.xml$')
python3 tod_scripts/test_report_upload_script.py "${report_filename}"
env:
LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }}
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