Skip to content

VED-812: Add e2e test pipeline #30

VED-812: Add e2e test pipeline

VED-812: Add e2e test pipeline #30

Workflow file for this run

name: Run e2e Tests
on:
workflow_call:
inputs:
apigee_environment:
required: true
type: string
environment:
required: true
type: string
sub_environment:
required: true
type: string
workflow_dispatch:
inputs:
apigee_environment:
type: choice
description: Select the Apigee proxy environment
options:
- internal-dev
- int
- ref
- prod
environment:
type: string
description: Select the backend environment
options:
- dev
- preprod
- prod
sub_environment:
type: string
description: Set the sub environment name e.g. pr-xxx, or green/blue in higher environments
# TODO - remove
pull_request:
types: [labeled, opened, synchronize, reopened, unlabeled]
jobs:
e2e-tests:
runs-on: ubuntu-latest
environment:
name: ${{ inputs.environment }}
env: # Sonarcloud - do not allow direct usage of untrusted data
APIGEE_ENVIRONMENT: internal-dev
BACKEND_ENVIRONMENT: dev
BACKEND_SUB_ENVIRONMENT: internal-dev
APIGEE_USERNAME: ${{ vars.APIGEE_USERNAME }}
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Install poetry
run: pip install poetry==2.1.4
- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
with:
python-version: 3.11
cache: "poetry"
- name: Install e2e test dependencies
working-directory: e2e
run: poetry install --no-root
- name: Get Apigee access token
working-directory: e2e
env:
APIGEE_PASSWORD: ${{ secrets.APIGEE_PASSWORD }}
APIGEE_BASIC_AUTH_TOKEN: ${{ secrets.APIGEE_BASIC_AUTH_TOKEN }}
APIGEE_OTP_KEY: ${{ secrets.APIGEE_OTP_KEY }}
run: |
CODE=$(poetry run python utils/compute_totp_code.py "$APIGEE_OTP_KEY")
echo "::add-mask::$CODE"
echo "Requesting access token from Apigee..."
response=$(curl -s -X POST "https://login.apigee.com/oauth/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json;charset=utf-8" \
-H "Authorization: Basic $APIGEE_BASIC_AUTH_TOKEN" \
-d "username=$APIGEE_USERNAME&password=$APIGEE_PASSWORD&mfa_token=$CODE&grant_type=password")
token=$(jq -e -r '.access_token' <<<"$response")
echo "::add-mask::$token"
echo "APIGEE_ACCESS_TOKEN=$token" >> $GITHUB_ENV
- name: Run e2e tests
working-directory: e2e
run: |
export PROXY_NAME=immunisation-fhir-api-internal-dev
export SERVICE_BASE_PATH=immunisation-fhir-api/FHIR/R4
export IMMS_DELTA_TABLE_NAME=imms-internal-dev-delta
export AWS_DOMAIN_NAME=internal-dev.imms.dev.vds.platform.nhs.uk
export DYNAMODB_TABLE_NAME=imms-internal-dev-imms-events
export AWS_SQS_QUEUE_NAME=imms-internal-dev-delta-dlq
export AWS_SNS_TOPIC_NAME=imms-internal-dev-delta-sns
poetry run python -m unittest -c -v