Skip to content

Commit 5f4ea2a

Browse files
merge main
2 parents c22f094 + ded557b commit 5f4ea2a

48 files changed

Lines changed: 17218 additions & 10974 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.template

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
1+
# Your github Personal Access Token (PAT)
12
PR_NUMBER=prxx # remove if needs to run against main
2-
GITHUB_TOKEN= # Your github Personal Access Token (PAT)
3+
GITHUB_TOKEN=
34

5+
# Apigee proxy name to be used for test execution
6+
# nhs-notify-supplier--internal-dev--nhs-notify-supplier-PR-XX
7+
PROXY_NAME=
48

5-
# The variables below are used for End to End tests
6-
PROXY_NAME= # information about the proxy name can be found in the tests/e2e-tests/README.md
9+
# APIM env to run e2e tests against, other options are: ref, int, prod
10+
API_ENVIRONMENT=internal-dev
711

12+
# Used for component and e2e tests
13+
# Account group controls default account id mapping for tests.
14+
# If omitted, tests default to dev:
15+
# TARGET_ACCOUNT_GROUP=nhs-notify-supplier-api-dev
16+
# Mapping used by tests:
17+
# nhs-notify-supplier-api-dev -> 820178564574
18+
# nhs-notify-supplier-api-nonprod -> 885964308133
19+
# nhs-notify-supplier-api-prod -> blocked (tests are intentionally disabled for prod)
20+
TARGET_ACCOUNT_GROUP=nhs-notify-supplier-api-dev
821

9-
10-
# * nhs-notify-supplier--internal-dev--nhs-notify-supplier
11-
# * nhs-notify-supplier--internal-dev--nhs-notify-supplier-PR-XX
12-
# * nhs-notify-supplier--ref--nhs-notify-supplier -- ref env
22+
# Resource namespace used to resolve AWS resource names for tests (main, pr123)
23+
# remove if needs to run against main
24+
TARGET_ENVIRONMENT=prxx
1325

1426
# API Keys
1527
# ========
@@ -25,9 +37,9 @@ export STATUS_ENDPOINT_API_KEY=xxx
2537

2638
# Private Keys
2739
# ============
28-
# private key used to generate authentication for tests ran against the internal-dev and internal-qa
29-
export NON_PROD_PRIVATE_KEY=xxx # path to the private key file
30-
# private key used to generate authentication for tests ran against the int environment
40+
# private key path used to generate authentication for tests ran against the internal-dev and internal-qa
41+
export NON_PROD_PRIVATE_KEY=xxx
42+
# private key path used to generate authentication for tests ran against the int environment
3143
export INTEGRATION_PRIVATE_KEY=xxx
32-
# private key used to generate authentication for tests ran against the prod environment
44+
# private key path used to generate authentication for tests ran against the prod environment
3345
export PRODUCTION_PRIVATE_KEY=xxx
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Acceptance tests - component
2+
description: "Run component acceptance tests for this repo"
3+
4+
inputs:
5+
testType:
6+
description: Type of test to run
7+
required: true
8+
9+
targetEnvironment:
10+
description: Name of the environment under test
11+
required: true
12+
13+
targetComponent:
14+
description: Name of the component under test
15+
required: true
16+
17+
targetAccountGroup:
18+
description: Name of the account group under test (e.g. nhs-notify-supplier-api-dev)
19+
required: true
20+
21+
runs:
22+
using: "composite"
23+
24+
steps:
25+
26+
- name: Repo setup
27+
uses: ./.github/actions/node-install
28+
with:
29+
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
30+
31+
- name: Fetch terraform output
32+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5
33+
with:
34+
name: terraform-output-${{ inputs.targetComponent }}
35+
36+
- name: Get Node version
37+
id: nodejs_version
38+
shell: bash
39+
run: |
40+
echo "nodejs_version=$(grep "^nodejs\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
41+
42+
- name: Run test - ${{ inputs.testType }}
43+
shell: bash
44+
env:
45+
TARGET_ENVIRONMENT: ${{ inputs.targetEnvironment }}
46+
TARGET_ACCOUNT_GROUP: ${{ inputs.targetAccountGroup }}
47+
run: |
48+
make test-${{ inputs.testType }}

.github/actions/acceptance-tests-e2e/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ inputs:
55
targetEnvironment:
66
description: Name of the environment under test
77
required: true
8+
targetAccountGroup:
9+
description: Name of the account group under test
10+
required: true
811

912
runs:
1013
using: "composite"
@@ -65,6 +68,10 @@ runs:
6568
env:
6669
TARGET_ENVIRONMENT: ${{ inputs.targetEnvironment }}
6770
PR_NUMBER: ${{ steps.set_pr_number.outputs.pr_number }}
71+
<<<<<<< HEAD
72+
=======
73+
TARGET_ACCOUNT_GROUP: ${{ inputs.targetAccountGroup }}
74+
>>>>>>> main
6875
run: |
6976
echo "$DEV_E2E_KEYS_PRIVATE" > "${GITHUB_WORKSPACE}/internal-dev-test-1.pem"
7077
chmod 600 "${GITHUB_WORKSPACE}/internal-dev-test-1.pem"

.github/actions/acceptance-tests/action.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ inputs:
1111
required: true
1212

1313
targetAccountGroup:
14-
description: Name of the account group under test
15-
default: nhs-notify-template-management-dev
14+
description: Name of the account group under test (e.g. nhs-notify-supplier-api-dev)
1615
required: true
1716

1817
targetComponent:
@@ -24,16 +23,18 @@ runs:
2423

2524
steps:
2625

27-
- name: Run component tests
26+
- name: Run components tests (sandbox and component tests)
2827
if: ${{ inputs.testType != 'e2e' }}
29-
uses: ./.github/actions/acceptance-tests-component
28+
uses: ./.github/actions/acceptance-tests-components
3029
with:
3130
testType: ${{ inputs.testType }}
3231
targetEnvironment: ${{ inputs.targetEnvironment }}
3332
targetComponent: ${{ inputs.targetComponent }}
33+
targetAccountGroup: ${{ inputs.targetAccountGroup }}
3434

3535
- name: Run e2e tests
36-
if: ${{ inputs.testType == 'e2e' && inputs.targetEnvironment == 'main' }}
36+
if: ${{ inputs.testType == 'e2e' }}
3737
uses: ./.github/actions/acceptance-tests-e2e
3838
with:
3939
targetEnvironment: ${{ inputs.targetEnvironment }}
40+
targetAccountGroup: ${{ inputs.targetAccountGroup }}

.github/workflows/deploy-dynamic-env-proxy.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ jobs:
2929

3030
- name: Resolve nodejs version
3131
id: toolversions
32-
run: echo "nodejs_version=$(grep '^nodejs\s' .tool-versions | cut -f2 -d' ')" >>
32+
run:
33+
echo "nodejs_version=$(grep '^nodejs\s' .tool-versions | cut -f2 -d' ')" >>
3334
"$GITHUB_OUTPUT"
3435

3536
- name: "Check if pull request exists for this branch and set

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# the project as automated steps to be executed on locally and in the CD pipeline.
33

44
include scripts/init.mk
5+
-include .env # Load environment variables from .env file if it exists
56

67
# ==============================================================================
78

@@ -130,11 +131,14 @@ ${VERBOSE}.SILENT: \
130131
# E2E Test commands #
131132
#####################
132133

134+
# https://pytest-xdist.readthedocs.io/en/stable/known-limitations.html#output-stdout-and-stderr-from-workers means pytest won't print to stdout even with -s
135+
PYTEST_WORKERS := 4 # set to 0 to see stdout/stderr when debugging e2e tests
136+
133137
TEST_CMD := APIGEE_ACCESS_TOKEN="$(APIGEE_ACCESS_TOKEN)" \
134138
STATUS_ENDPOINT_API_KEY="$(STATUS_ENDPOINT_API_KEY)" \
135139
PYTHONPATH=. poetry run pytest --disable-warnings -vv \
136140
--color=yes \
137-
-n 4 \
141+
-n $(PYTEST_WORKERS) \
138142
--api-name=nhs-notify-supplier \
139143
--proxy-name="$(PROXY_NAME)" \
140144
-s \
@@ -145,7 +149,6 @@ TEST_CMD := APIGEE_ACCESS_TOKEN="$(APIGEE_ACCESS_TOKEN)" \
145149
--only-rerun 'AssertionError: Unexpected 502' \
146150
--junitxml=test-report.xml
147151

148-
149152
.internal-dev-test:
150153
@cd tests/e2e-tests && \
151154
$(TEST_CMD) \
@@ -161,7 +164,7 @@ TEST_CMD := APIGEE_ACCESS_TOKEN="$(APIGEE_ACCESS_TOKEN)" \
161164
PROD_CMD := APIGEE_ACCESS_TOKEN="$(APIGEE_ACCESS_TOKEN)" \
162165
PYTHONPATH=. poetry run pytest --disable-warnings -vv \
163166
--color=yes \
164-
-n 4 \
167+
-n $(PYTEST_WORKERS) \
165168
--api-name=nhs-notify-supplier \
166169
--proxy-name="$(PROXY_NAME)" \
167170
-s \

eslint.config.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export default defineConfig([
5656
'**/node_modules',
5757
'**/dist',
5858
'**/test-results',
59+
'**/target/**',
5960
'**/playwright-report*',
6061
'eslint.config.mjs',
6162
// newly ignored generated/build artifacts
@@ -91,6 +92,22 @@ export default defineConfig([
9192
},
9293
},
9394
{ files: ['**/*.json'], extends: [tseslint.configs.disableTypeChecked] },
95+
{
96+
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
97+
extends: [tseslint.configs.disableTypeChecked],
98+
},
99+
{
100+
files: ['**/*.cjs'],
101+
languageOptions: {
102+
globals: {
103+
module: 'readonly',
104+
require: 'readonly',
105+
exports: 'readonly',
106+
__dirname: 'readonly',
107+
__filename: 'readonly',
108+
},
109+
},
110+
},
94111

95112
{
96113
settings: {

0 commit comments

Comments
 (0)