-
Notifications
You must be signed in to change notification settings - Fork 2
Feature/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
234d2c8
c40c3b6
5d727d1
53a5d23
c6b3ac8
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 | ||
| 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 | ||
|
|
||
| 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" | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,11 +60,7 @@ jobs: | |
| - name: "Set environment" | ||
| shell: bash | ||
| run: | | ||
| if [ "${{ inputs.pr_number }}" != "" ]; then | ||
| echo "ENVIRONMENT=pr${{ inputs.pr_number }}" >> $GITHUB_ENV | ||
| else | ||
| echo "ENVIRONMENT=main" >> $GITHUB_ENV | ||
| fi | ||
| echo "ENVIRONMENT=main" >> $GITHUB_ENV | ||
|
|
||
| - name: Trigger Acceptance Tests | ||
| shell: bash | ||
|
|
@@ -78,23 +74,8 @@ jobs: | |
| --infraRepoName "nhs-notify-supplier-api" \ | ||
| --releaseVersion "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" \ | ||
| --overrideProjectName "nhs" \ | ||
| --internalRef "feature/CCM-14778" \ | ||
|
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. would we be changing it?
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. Yep, I'm going to revert this once the internal repo change has merged |
||
| --targetEnvironment "$ENVIRONMENT" \ | ||
| --targetAccountGroup "nhs-notify-supplier-api-dev" \ | ||
| --targetComponent "api" | ||
|
|
||
| run-e2e-tests: | ||
| name: Run End-to-End Tests | ||
| runs-on: ubuntu-latest | ||
| if: inputs.proxy_deployed == 'true' | ||
| steps: | ||
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
|
|
||
| - name: "Run e2e tests" | ||
| #uses: ./.github/actions/e2e-tests | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| NON_PROD_API_KEY: ${{ secrets.NON_PROD_API_KEY }} | ||
| INTERNAL_DEV_TEST_PEM: ${{ secrets.INTERNAL_DEV_TEST_PEM }} | ||
| shell: bash | ||
| run: | | ||
| echo "E2E tests are currently disabled. See CCM-14778" | ||
| --targetComponent "api" \ | ||
| --extraSecretNames '["/dev/e2e/keys/apim/main","/dev/e2e/keys/apim/pr","/dev/e2e/keys/apim/status","/dev/e2e/keys/private"]' | ||
Uh oh!
There was an error while loading. Please reload this page.