-
Notifications
You must be signed in to change notification settings - Fork 1
[NDR-321] Update make file & E2E test readme #993
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?
Conversation
| | 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. | |
There was a problem hiding this comment.
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.") |
There was a problem hiding this comment.
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
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)" ] || { \ |
There was a problem hiding this comment.
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! :)
|
|
||
| ## 🔧 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
lambdas/tests/e2e/README.md
Outdated
| # 🧪 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. |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.
Code security issues foundView full details here. |
|



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:
Deploy - Sandbox- workflow runSANDBOX Full- Deploy feature branch to sandbox- workflow run