Skip to content

Conversation

@megan-bower4
Copy link
Contributor

@megan-bower4 megan-bower4 commented Jan 13, 2026

Overview

Jira ticket: NDR-321

Description

Update to the makefile so it is easier to read, and gives a nicer error message when WORKSPACE isn't provided as a parameter to the fhir e2e tests.

Updated the E2E test readme also.

Context

When a new member of PDM ran the E2E tests from scratch they noted some readme improvements that would be helpful. These changes should ensure anyone can pick up the readme and run the E2E tests from scratch.

Checklist

Tasks for all changes:

  • 1. I have linked this PR to its Jira ticket.
  • 2. I have run git pre-commits.
  • 3. I have added and/or updated relevant tests.
  • 4. I have updated relevant documentation.
  • 5. I have considered the cross-team impact (and have PR approval from both Core & Demographics if necessary).
  • 6. I have successfully deployed this change to a sandbox and witnessed unit and e2e tests passing:

@megan-bower4 megan-bower4 changed the title NDR-321 Update make file & E2E test readme [NDR-321] Update make file & E2E test readme Jan 13, 2026
| Environment Variable | Description |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `NDR_API_KEY` | The API key required to authenticate requests to the NDR API. API Gateway → API Keys for associated env e.g. ndr-dev_apim-api-key |
| `NDR_API_ENDPOINT` | The URI string used to connect to the NDR API. |
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now constructed within the data helper class so no longer required to set.

def build_env(self, table_name, bucket_name):
if not self.workspace:
raise ValueError("WORKSPACE environment variable is missing or empty.")
raise ValueError("AWS_WORKSPACE environment variable is missing or empty.")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to reflect the variable name it is expecting from line 22

@megan-bower4 megan-bower4 marked this pull request as ready for review January 13, 2026 15:26
@megan-bower4 megan-bower4 requested review from a team as code owners January 13, 2026 15:26
Makefile Outdated

test-fhir-api-e2e: ## Runs FHIR API E2E tests. Usage: make test-fhir-api-e2e WORKSPACE=<workspace> CONTAINER=<true|false>
test-fhir-api-e2e: ## Runs Core FHIR API E2E tests. Usage: make test-fhir-api-e2e WORKSPACE=<workspace> CONTAINER=<true|false>
@[ -n "$(WORKSPACE)" ] || { \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a pattern used quite frequently in other NHS projects that ensure variables are defined.

See the 'guard' wildcard function in https://github.com/NHSDigital/patient-data-manager/blob/72276ae131dff065a2f9b9157fe812fec4bf707d/Makefile#L16

Your function could then be defined with
test-fhir-api-e2e: guard-WORKSPACE ## Comments
Assuming it wouldn't break your awk! :)

tim-knight-nhs
tim-knight-nhs previously approved these changes Jan 13, 2026

## 🔧 Available Make Commands

If you are not using the dev container you **must** run `make env` before running the E2E tests. This sets up your venv and any required dependencies.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be suggesting this? It's just the whole point of a dev container is that everyone uses it. I can only see very rare cases where it shouldn't be being used and if so that person should be able to work things out for themselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ticket was from before the dev container was added and Charlie was struggling to run the E2E tests straight off the bat as the instructions were missing this step (the main purpose of this ticket was to add this instruction specifically).

And the dev container is still optional, even if preferred, so we should be keeping documentation up to date for how to run tests outside of it. This readme references instructions for both dev container and not already.

# 🧪 End-to-End Testing Setup

These tests focus on the features of the NDR. This will serve as a blended suite of integration and end-to-end (E2E) tests, with the aim to validate API functionality and snapshot comparisons.
These tests serve as a blended suite of integration and end-to-end (E2E) tests to validate FHIR API functionality and snapshot comparisons.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm being really pedantic, these are not integration tests.

## 🌍 Required Environment Variables

In order to execute the E2E tests without mTLS (i.e. `make test-api-e2e`) you will need to ensure the following environment variables are set. You can export them in your shell configuration file (`~/.zshrc` or `~/.bashrc`) or **temporarily** add them to the `conftest.py`:
In order to execute the Lloyd George API E2E tests (i.e. `make test-api-e2e`) you will need to ensure the following environment variables are set. You can export them in your shell configuration file (`~/.zshrc` or `~/.bashrc`) or equivalently your aws-vault session if using the dev container. Or **temporarily** add them to the `conftest.py`, but do not commit these:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not for this ticket. But I feel like the "make test-api-e2e" command should be renamed to "make test-fhir-api-e2e-lg" and the PDM/Core to "make test-fhir-e2e-core"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I agree, I'll write up a new ticket for it!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


help: ## This is a help message
@grep -E --no-filename '^[a-zA-Z-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-42s\033[0m %s\n", $$1, $$2}'
help: ## Show available targets and usage.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

./scripts/aws/download-api-certs.sh $(WORKSPACE)

test-api-e2e:
test-api-e2e: ## Runs LG FHIR API E2E tests. See readme for required environment variables. Usage: make test-api-e2e CONTAINER=<true|false>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, see what I said earlier about renaming these make commands.

@github-actions
Copy link

Code security issues found

View full details here.

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants