Skip to content

Commit 5e08477

Browse files
committed
Merge branch 'main' into feature/CCM-12185-addGetMiEndpoint
2 parents 013edbf + ded557b commit 5e08477

49 files changed

Lines changed: 4975 additions & 3113 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: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
1-
PR_NUMBER=prxx # remove if needs to run against main
2-
TARGET_ENVIRONMENT=prxx # remove if needs to run against main
3-
API_ENVIRONMENT=internal-dev # change to relevant environment
4-
AWS_PROFILE=supplier-dev
5-
NHSD_APIM_TOKEN=
6-
GITHUB_TOKEN= # Your github Personal Access Token (PAT)
7-
# The variables below are used for End to End tests
8-
PROXY_NAME= # information about the proxy name can be found in the tests/e2e-tests/README.md
1+
# Your github Personal Access Token (PAT)
2+
GITHUB_TOKEN=
93

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

8+
# APIM env to run e2e tests against, other options are: ref, int, prod
9+
API_ENVIRONMENT=internal-dev
1110

12-
# * nhs-notify-supplier--internal-dev--nhs-notify-supplier
13-
# * nhs-notify-supplier--internal-dev--nhs-notify-supplier-PR-XX
14-
# * nhs-notify-supplier--ref--nhs-notify-supplier -- ref env
11+
# Used for component and e2e tests
12+
# Account group controls default account id mapping for tests.
13+
# If omitted, tests default to dev:
14+
# TARGET_ACCOUNT_GROUP=nhs-notify-supplier-api-dev
15+
# Mapping used by tests:
16+
# nhs-notify-supplier-api-dev -> 820178564574
17+
# nhs-notify-supplier-api-nonprod -> 885964308133
18+
# nhs-notify-supplier-api-prod -> blocked (tests are intentionally disabled for prod)
19+
TARGET_ACCOUNT_GROUP=nhs-notify-supplier-api-dev
20+
21+
# Resource namespace used to resolve AWS resource names for tests (main, pr123)
22+
# remove if needs to run against main
23+
TARGET_ENVIRONMENT=prxx
1524

1625
# API Keys
1726
# ========
@@ -30,9 +39,9 @@ export STATUS_ENDPOINT_API_KEY=xxx
3039

3140
# Private Keys
3241
# ============
33-
# private key used to generate authentication for tests ran against the internal-dev and internal-qa
34-
export NON_PROD_PRIVATE_KEY=xxx # path to the private key file
35-
# private key used to generate authentication for tests ran against the int environment
42+
# private key path used to generate authentication for tests ran against the internal-dev and internal-qa
43+
export NON_PROD_PRIVATE_KEY=xxx
44+
# private key path used to generate authentication for tests ran against the int environment
3645
export INTEGRATION_PRIVATE_KEY=xxx
37-
# private key used to generate authentication for tests ran against the prod environment
46+
# private key path used to generate authentication for tests ran against the prod environment
3847
export PRODUCTION_PRIVATE_KEY=xxx

.github/actions/acceptance-tests-component/action.yml renamed to .github/actions/acceptance-tests-components/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ inputs:
1414
description: Name of the component under test
1515
required: true
1616

17+
targetAccountGroup:
18+
description: Name of the account group under test (e.g. nhs-notify-supplier-api-dev)
19+
required: true
20+
1721
runs:
1822
using: "composite"
1923

@@ -39,5 +43,6 @@ runs:
3943
shell: bash
4044
env:
4145
TARGET_ENVIRONMENT: ${{ inputs.targetEnvironment }}
46+
TARGET_ACCOUNT_GROUP: ${{ inputs.targetAccountGroup }}
4247
run: |
4348
make test-${{ inputs.testType }}

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

Lines changed: 4 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,7 @@ runs:
6568
env:
6669
TARGET_ENVIRONMENT: ${{ inputs.targetEnvironment }}
6770
PR_NUMBER: ${{ steps.set_pr_number.outputs.pr_number }}
71+
TARGET_ACCOUNT_GROUP: ${{ inputs.targetAccountGroup }}
6872
run: |
6973
echo "$DEV_E2E_KEYS_PRIVATE" > "${GITHUB_WORKSPACE}/internal-dev-test-1.pem"
7074
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

.github/workflows/stage-3-build.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ jobs:
189189
--terraformAction "apply" \
190190
--overrideProjectName "nhs" \
191191
--overrideRoleName "nhs-main-acct-supplier-api-github-deploy"
192+
192193
populate-config:
193194
name: "Populate Supplier Config"
194195
runs-on: ubuntu-latest

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)