Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
71f32bf
tests passing locally
Vlasis-Perdikidis Jul 27, 2026
2bd2e59
re-enable sandbox tests in pipeline
Vlasis-Perdikidis Jul 27, 2026
4c4e46f
correct SUPPLIER_API_URL_SANDBOX for pipeilne
Vlasis-Perdikidis Jul 28, 2026
2d0da5a
reference PR-927 from internal
Vlasis-Perdikidis Jul 29, 2026
a63f98b
deploy proxy
Vlasis-Perdikidis Jul 29, 2026
986e5a7
trigger build
Vlasis-Perdikidis Jul 29, 2026
888cc70
trigger another build
Vlasis-Perdikidis Jul 30, 2026
f745942
trigger another build
Vlasis-Perdikidis Jul 30, 2026
4a4bdd4
trigger another build
Vlasis-Perdikidis Jul 30, 2026
d842802
trigger another build
Vlasis-Perdikidis Aug 11, 2026
ccd3790
trigger another build
Vlasis-Perdikidis Aug 11, 2026
8f17205
commit local changes
Vlasis-Perdikidis Aug 12, 2026
6925401
trigger build
Vlasis-Perdikidis Aug 13, 2026
9fa5f4f
remove TODO comments
Vlasis-Perdikidis Aug 13, 2026
f2a3e76
sync package-lock.json
Vlasis-Perdikidis Aug 13, 2026
28c5a55
restore package-lock.json file from main
Vlasis-Perdikidis Aug 13, 2026
43f304b
trigger another build
Vlasis-Perdikidis Aug 14, 2026
73ab704
start sandbox server before running sandbox tests
Vlasis-Perdikidis Aug 19, 2026
e2e0fab
point to PR659 proxy
Vlasis-Perdikidis Aug 21, 2026
640a5b2
remove step that starts the container
Vlasis-Perdikidis Aug 24, 2026
3093564
remove lines for creating/starting the sandbox container
Vlasis-Perdikidis Aug 24, 2026
1b5db66
upload sandbox spec file
Vlasis-Perdikidis Aug 26, 2026
510910f
place artifacts into separate folders
Vlasis-Perdikidis Aug 27, 2026
1916caa
correct download sandbox artifact name
Vlasis-Perdikidis Aug 27, 2026
1a816ba
place sandbox spec to separate file instead of sub-folder
Vlasis-Perdikidis Aug 27, 2026
e68b067
Merge branch 'main' into fix/CCM-20834-fix_sandbox_tests
Vlasis-Perdikidis Aug 27, 2026
824552a
remove comments and add information on how to run sandbox tests
Vlasis-Perdikidis Aug 27, 2026
da528dc
commit the sandbox package-lock file
Vlasis-Perdikidis Aug 27, 2026
362135e
resolve peer dependency issues in sandbox dependencies
Vlasis-Perdikidis Aug 27, 2026
85d898c
resolve PR URL first for supplier_api_url_sandbox
Vlasis-Perdikidis Aug 27, 2026
49cc72a
modify the condition
Vlasis-Perdikidis Aug 28, 2026
1fb0a00
echo event_name
Vlasis-Perdikidis Aug 28, 2026
1958b68
set event_name=workflow_dispatch
Vlasis-Perdikidis Aug 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/actions/acceptance-tests-components/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@ runs:
env:
TARGET_ENVIRONMENT: ${{ inputs.targetEnvironment }}
TARGET_ACCOUNT_GROUP: ${{ inputs.targetAccountGroup }}
SUPPLIER_API_URL_SANDBOX: ${{ github.event_name == 'workflow_dispatch' && inputs.testType == 'sandbox' && format('https://internal-dev-sandbox.api.service.nhs.uk/nhs-notify-supplier-PR-{0}', github.event.pull_request.number) || inputs.testType == 'sandbox' && 'http://127.0.0.1:9000' || 'https://internal-dev-sandbox.api.service.nhs.uk/nhs-notify-supplier' }}
run: |
echo "VLASIS - event_name = ${{ github.event_name }}"
echo "VLASIS - SUPPLIER_API_URL_SANDBOX = $SUPPLIER_API_URL_SANDBOX"
make test-${{ inputs.testType }}
1 change: 0 additions & 1 deletion .github/actions/acceptance-tests-e2e/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ runs:
else
echo "pr_number=$env" >> $GITHUB_OUTPUT
fi

- name: Determine if proxy has been deployed
id: check_proxy_deployed
env:
Expand Down
19 changes: 18 additions & 1 deletion .github/actions/build-proxies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ runs:
name: api-oas-specification-${{ inputs.apimEnv }}${{ inputs.version != '' && format('-{0}', inputs.version) || '' }}
path: ./build

# should I hard-code it to internal-dev-sandbox? What about int/prod?
- name: Download Sandbox OAS Spec artifact from workflow
if: ${{ inputs.buildSandbox == 'true' && inputs.isRelease == 'false' }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: api-oas-specification-internal-dev-sandbox${{ inputs.version != '' && format('-{0}', inputs.version) || '' }}
path: ./build-sandbox

- name: Download OAS Spec artifact from release
if: ${{ inputs.isRelease == 'true' }}
shell: bash
Expand Down Expand Up @@ -99,6 +107,14 @@ runs:
name: ${{ env.APIM_ENV }}-build-output
path: ./build

- name: Upload Sandbox OAS Spec
if: ${{ inputs.buildSandbox == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ env.APIM_ENV }}-build-output-sandbox
path: ./build-sandbox

# NOTE TO SELF: remove --internalRef after internal is merged into main
- name: Trigger deploy proxy
env:
APP_CLIENT_ID: ${{ env.APP_CLIENT_ID }}
Expand All @@ -116,4 +132,5 @@ runs:
--apimEnvironment "${{ env.APIM_ENV }}" \
--boundedContext "notify-supplier" \
--targetDomain "$TARGET_DOMAIN" \
--version "${{ inputs.version }}"
--version "${{ inputs.version }}" \
--internalRef "fix/CCM-22538_deploy_sandbox_server"
3 changes: 2 additions & 1 deletion .github/actions/test-types.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
"component",
"e2e"
"e2e",
"sandbox"
]
2 changes: 1 addition & 1 deletion .github/workflows/stage-3-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
artefact-oas-spec:
name: "OAS spec ready"
runs-on: ubuntu-latest
needs: [artefact-oas-spec-pr, artefact-oas-spec-main]
needs: [artefact-oas-spec-pr, artefact-oas-spec-main, artefact-oas-spec-sandbox]
if: always() && !failure()
steps:
- run: echo "OAS spec build complete"
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/stage-4-acceptance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
echo "ENVIRONMENT=main" >> $GITHUB_ENV
fi

# NOTE TO SELF: Remove --internalRef after internal is merged into main
- name: Trigger Acceptance Tests
shell: bash
env:
Expand All @@ -80,4 +81,5 @@ jobs:
--targetEnvironment "$ENVIRONMENT" \
--targetAccountGroup "nhs-notify-supplier-api-dev" \
--targetComponent "api" \
--extraSecretNames '["/dev/e2e/keys/apim/main","/dev/e2e/keys/apim/pr","/dev/e2e/keys/apim/pr/secondary","/dev/e2e/keys/apim/status","/dev/e2e/keys/private"]'
--extraSecretNames '["/dev/e2e/keys/apim/main","/dev/e2e/keys/apim/pr","/dev/e2e/keys/apim/pr/secondary","/dev/e2e/keys/apim/status","/dev/e2e/keys/private"]' \
--internalRef "fix/CCM-22538_deploy_sandbox_server"
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.22.0
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!-- vale off -->

# NHS Notify Supplier API

[![1. CI/CD pull request](https://github.com/NHSDigital/nhs-notify-supplier-api/actions/workflows/cicd-1-pull-request.yaml/badge.svg)](https://github.com/NHSDigital/nhs-notify-supplier-api/actions/workflows/cicd-1-pull-request.yaml)
Expand Down Expand Up @@ -29,6 +30,7 @@ This repository documents the Supplier API specification and provides an SDK wit
- [Prerequisites and Configuration](#prerequisites-and-configuration)
- [SDKs](#sdks)
- [Build](#build)
- [Unit Testing](#unit-testing)
- [Documentation](#documentation-1)
- [GitHub Actions CI/CD](#github-actions-cicd)
- [CI (Automatic)](#ci-automatic)
Expand Down Expand Up @@ -99,14 +101,14 @@ New developers of the NHS Notify Supplier API should understand the below.
- In the project's root directory create an `.env` file based on the `.env.template` file and fill variables as needed.
- Create the file `~/.npmrc` with the contents:

```dsconfig
# Authenticate to GitHub Packages for github.com
//npm.pkg.github.com/:_authToken=<Insert your Github PAT (Personal Access Token)>
```dsconfig
# Authenticate to GitHub Packages for github.com
//npm.pkg.github.com/:_authToken=<Insert your Github PAT (Personal Access Token)>


# Package is scoped under @org, set registry for that scope
@nhsdigital:registry=https://npm.pkg.github.com
```
# Package is scoped under @org, set registry for that scope
@nhsdigital:registry=https://npm.pkg.github.com
```

- Install `node` (to run `npm install` and build the project)
- Install `aws cli` to be able to connect to AWS (needed for some tests)
Expand Down
7 changes: 6 additions & 1 deletion sandbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"eslint": "^9.27.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.17.2",
"mocha": "^11.8.0"
},
"overrides": {
"eslint-config-airbnb-base": {
"eslint": "^9.27.0"
}
},
"eslintConfig": {
"env": {
"node": true
Expand Down
13 changes: 5 additions & 8 deletions specification/api/components/schemas/apiGatewayError.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
type: object
description: API gateway error response
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: "Bad Gateway"
properties:
message:
type: string
example: Bad Gateway
7 changes: 6 additions & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ Test suites that validate the supplier API beyond individual package unit tests.
2. In the root level create an `.env` file and setup the `GITHUB_TOKEN` and `TARGET_ENVIRONMENT` variables (use `.env.template` as a guide)
3. Source the env file by running `set -a` -> `source .env` -> `set +a`
4. Login to your AWS account by running `aws sso login` in the terminal
- **Sandbox tests** require a sandbox server.
- **Sandbox tests**: We need to start the sandbox server from the `/sandbox` folder in the root directory (read /sandbox/README.md for more information).
- Run locally:
1. from project's root directory `cd sandbox && npm install && npm start`
2. from project's root directory `make test-sandbox` or `cd tests && npm install && npm run test:sandbox`
- Run in Pipeline:
1. You need to deploy the proxies in your Pull Request with the label `deploy-proxy`. This should then build the sandbox server, deploy the artifact and deploy the sandbox proxy via proxygen (you might need to re-run the acceptance tests stage in the pipeline, as the server might take some time to deploy and be unreachable from the tests).
- **Performance and E2E tests** require AWS credentials, deployed infrastructure, and seeded test data. See `scripts/test-data/` for test data generation and `tests/e2e-tests/README.md` for environment-specific setup.
1. Deploy a dynamic environment (can be achieved by creating a Pull Request). Take a note of the environment e.g. pr1234.
2. Build proxies in the dynamic environment by setting the label `deploy_proxy` (ask a member of the team if you need help)
Expand Down
3 changes: 2 additions & 1 deletion tests/constants/api-constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const SUPPLIER_LETTERS = "letters";
const DEFAULT_SUPPLIER_API_URL_SANDBOX = "http://127.0.0.1:9000";
export const SUPPLIER_API_URL_SANDBOX =
"https://internal-dev-sandbox.api.service.nhs.uk/nhs-notify-supplier";
process.env.SUPPLIER_API_URL_SANDBOX ?? DEFAULT_SUPPLIER_API_URL_SANDBOX;
export const AWS_REGION = "eu-west-2";
export const envName = process.env.TARGET_ENVIRONMENT ?? "main";
export const API_NAME = `nhs-${envName}-supapi`;
Expand Down
8 changes: 8 additions & 0 deletions tests/sandbox/testCases/get-letter-status-test-cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type GetLetterData = {
attributes: {
specificationId: string;
groupId: string;
sha256Hash: string;
status: string;
};
};
Expand All @@ -39,6 +40,7 @@ type RejectedLetterData = {
attributes: {
specificationId: string;
groupId: string;
sha256Hash: string;
status: string;
reasonCode: string;
reasonText: string;
Expand Down Expand Up @@ -74,6 +76,8 @@ export const apiSandboxGetLetterStatusTestData: ApiSandboxGetLetterStatusTestCas
attributes: {
specificationId: "2WL5eYSWGzCHlGmzNxuqVusPxDg",
groupId: "c5d93f917f5546d08beccf770a915d96",
sha256Hash:
"3a7bd3e2360a3d29eea436fcfb7e44c735d117c8f2f1d2d1e4f6e8f7e6e8f7e6",
status: "ACCEPTED",
},
},
Expand All @@ -91,6 +95,8 @@ export const apiSandboxGetLetterStatusTestData: ApiSandboxGetLetterStatusTestCas
attributes: {
specificationId: "2WL5eYSWGzCHlGmzNxuqVusPxDg",
groupId: "c5d93f917f5546d08beccf770a915d96",
sha256Hash:
"3a7bd3e2360a3d29eea436fcfb7e44c735d117c8f2f1d2d1e4f6e8f7e6e8f7e6",
status: "REJECTED",
reasonCode: "R01",
reasonText: "failed validation",
Expand All @@ -110,6 +116,8 @@ export const apiSandboxGetLetterStatusTestData: ApiSandboxGetLetterStatusTestCas
attributes: {
specificationId: "2WL5eYSWGzCHlGmzNxuqVusPxDg",
groupId: "c5d93f917f5546d08beccf770a915d96",
sha256Hash:
"3a7bd3e2360a3d29eea436fcfb7e44c735d117c8f2f1d2d1e4f6e8f7e6e8f7e6",
status: "CANCELLED",
reasonCode: "R01",
},
Expand Down
3 changes: 3 additions & 0 deletions tests/sandbox/testCases/get-list-of-letters-test-cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type ApiData = {
attributes: {
specificationId: string;
groupId: string;
sha256Hash: string;
status: string;
};
};
Expand Down Expand Up @@ -59,6 +60,8 @@ export const apiSandboxGetLettersRequestTestData: ApiSandboxGetLettersRequestTes
attributes: {
specificationId: "2WL5eYSWGzCHlGmzNxuqVusPxDg",
groupId: "c5d93f917f5546d08beccf770a915d96",
sha256Hash:
"3a7bd3e2360a3d29eea436fcfb7e44c735d117c8f2f1d2d1e4f6e8f7e6e8f7e6",
status: "PENDING",
},
},
Expand Down
Loading