-
Notifications
You must be signed in to change notification settings - Fork 2
CCM-14778: fix e2 e tests #534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: Acceptance tests - component | ||
| description: "Run component acceptance tests for this repo" | ||
|
|
||
| inputs: | ||
| testType: | ||
| description: Type of test to run | ||
| required: true | ||
|
|
||
| targetEnvironment: | ||
| description: Name of the environment under test | ||
| required: true | ||
|
|
||
| targetComponent: | ||
| description: Name of the component under test | ||
| required: true | ||
|
|
||
| runs: | ||
| using: "composite" | ||
|
|
||
| steps: | ||
|
|
||
| - name: Repo setup | ||
| uses: ./.github/actions/node-install | ||
| with: | ||
| GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | ||
|
|
||
| - name: Fetch terraform output | ||
| uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5 | ||
| with: | ||
| name: terraform-output-${{ inputs.targetComponent }} | ||
|
|
||
| - name: Get Node version | ||
| id: nodejs_version | ||
| shell: bash | ||
| run: | | ||
| echo "nodejs_version=$(grep "^nodejs\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Run test - ${{ inputs.testType }} | ||
| shell: bash | ||
| env: | ||
| TARGET_ENVIRONMENT: ${{ inputs.targetEnvironment }} | ||
| run: | | ||
| make test-${{ inputs.testType }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| name: Acceptance tests - e2e | ||
| description: "Run e2e acceptance tests for this repo" | ||
|
|
||
| inputs: | ||
| targetEnvironment: | ||
| description: Name of the environment under test | ||
| required: true | ||
|
|
||
| runs: | ||
| using: "composite" | ||
|
|
||
| steps: | ||
| - name: "Set PR NUMBER" | ||
| id: set_pr_number | ||
| shell: bash | ||
| run: | | ||
| env="${{ inputs.targetEnvironment }}" | ||
| if [[ "$env" == main ]]; then | ||
| echo "pr_number=" >> $GITHUB_OUTPUT | ||
| elif [[ "$env" == pr* ]]; then | ||
| echo "pr_number=${env#pr}" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "pr_number=$env" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Determine if proxy has been deployed | ||
| id: check_proxy_deployed | ||
| env: | ||
| GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | ||
| PR_NUMBER: ${{ steps.set_pr_number.outputs.pr_number }} | ||
| shell: bash | ||
|
stevebux marked this conversation as resolved.
|
||
| run: | | ||
| if [[ -z "$PR_NUMBER" ]]; then | ||
| echo "No pull request detected; proxy was deployed." | ||
| echo "proxy_deployed=true" >> $GITHUB_OUTPUT | ||
| exit 0 | ||
| fi | ||
|
|
||
| branch_name=${GITHUB_HEAD_REF:-$(echo $GITHUB_REF | sed 's#refs/heads/##')} | ||
|
|
||
| labels=$(gh pr view "$PR_NUMBER" --json labels --jq '.labels[].name') | ||
| echo "Labels on PR #$PR_NUMBER: $labels" | ||
|
|
||
| if echo "$labels" | grep -Fxq 'deploy-proxy'; then | ||
| echo "proxy_deployed=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "proxy_deployed=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Repo setup | ||
| if: ${{ steps.check_proxy_deployed.outputs.proxy_deployed == 'true' }} | ||
| uses: ./.github/actions/node-install | ||
| with: | ||
| GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | ||
|
|
||
| - name: Install poetry and e2e test dependencies | ||
| shell: bash | ||
| run: | | ||
| pipx install poetry | ||
| cd tests/e2e-tests && poetry install | ||
|
|
||
| - name: Run tests | ||
| if: ${{ steps.check_proxy_deployed.outputs.proxy_deployed == 'true' }} | ||
| shell: bash | ||
| env: | ||
| TARGET_ENVIRONMENT: ${{ inputs.targetEnvironment }} | ||
| PR_NUMBER: ${{ steps.set_pr_number.outputs.pr_number }} | ||
| run: | | ||
| echo "$DEV_E2E_KEYS_PRIVATE" > "${GITHUB_WORKSPACE}/internal-dev-test-1.pem" | ||
| chmod 600 "${GITHUB_WORKSPACE}/internal-dev-test-1.pem" | ||
| BASE_PROXY_NAME=nhs-notify-supplier--internal-dev--nhs-notify-supplier | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be great if we could also run these tests in nonprod / int. If it's too complicated to add them now, maybe worth raising a ticket to it, it would make the release process a lot easier!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm reluctant to make this ticket any bigger than it is, but it's a good suggestion - the tests themselves have been written to support nonprod and int, so hopefully wouldn't need to change. I'll raise a ticket
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://nhsd-jira.digital.nhs.uk/browse/CCM-17507 has been raised |
||
|
|
||
| export API_ENVIRONMENT=internal-dev | ||
| if [[ -z "$PR_NUMBER" ]]; then | ||
| export PROXY_NAME="${BASE_PROXY_NAME}" | ||
| export NON_PROD_API_KEY="${DEV_E2E_KEYS_APIM_MAIN}" | ||
| else | ||
| export PROXY_NAME="${BASE_PROXY_NAME}-PR-${PR_NUMBER}" | ||
| export NON_PROD_API_KEY="${DEV_E2E_KEYS_APIM_PR}" | ||
| fi | ||
|
|
||
| export STATUS_ENDPOINT_API_KEY="${DEV_E2E_KEYS_APIM_STATUS}" | ||
| export NON_PROD_PRIVATE_KEY="${GITHUB_WORKSPACE}/internal-dev-test-1.pem" | ||
| make .internal-dev-test | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| [ | ||
| "component", | ||
| "e2e", | ||
| "sandbox" | ||
| ] |
Uh oh!
There was an error while loading. Please reload this page.