From 611a8c8bc681b3fa63dbb4165a8362e0591d9517 Mon Sep 17 00:00:00 2001 From: Carlo Costino Date: Fri, 1 Mar 2024 12:23:05 -0500 Subject: [PATCH] Add E2E configuration information to docs This changeset adds a bit of missing information to our README and documentation for E2E test configuration. This is required for the project to be set up correctly, and while it will work out of the box, there are a couple of adjustments that need to be made to ensure everything is configured correctly. Signed-off-by: Carlo Costino --- README.md | 31 +++++++++++++++++++++++++++++++ docs/all.md | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/README.md b/README.md index 94aea0c41..d435cfc7b 100644 --- a/README.md +++ b/README.md @@ -299,6 +299,36 @@ brew services start postgresql@15 brew services start redis ``` +### Final environment setup + +There's one final thing to adjust in the newly created `.env` file. This +project has support for end-to-end (E2E) tests and has some additional checks +for the presence of an E2E test user so that it can be authenticated properly. + +In the `.env` file, you should see this section: + +``` +############################################################# + +# E2E Testing + +NOTIFY_E2E_TEST_EMAIL=example@fake.gov +NOTIFY_E2E_TEST_PASSWORD="don't write secrets to the sample file" +``` + +You can leave the email address alone or change it to something else to your +liking. + +**You should absolutely change the `NOTIFY_E2E_TEST_PASSWORD` environment +variable to something else, preferably a lengthy passphrase.** + +With those two environment variable set, the database migrations will run +properly and an E2E test user will be ready to go for use in the admin project. + +_Note: Whatever you set these two environment variables to, you'll need to +match their values on the admin side. Please see the admin README and +documentation for more details._ + ## Running the Project and Routine Maintenance The first time you run the project you'll need to run the project setup from the @@ -410,6 +440,7 @@ instructions above for more details. - [CI testing](./docs/all.md#ci-testing) - [Manual testing](./docs/all.md#manual-testing) - [To run a local OWASP scan](./docs/all.md#to-run-a-local-owasp-scan) + - [End-to-end testing](./docs/all.md#end-to-end-testing) - [Deploying](./docs/all.md#deploying) - [Egress Proxy](./docs/all.md#egress-proxy) - [Managing environment variables](./docs/all.md#managing-environment-variables) diff --git a/docs/all.md b/docs/all.md index 4803102dd..57743f97c 100644 --- a/docs/all.md +++ b/docs/all.md @@ -11,6 +11,7 @@ - [CI testing](#ci-testing) - [Manual testing](#manual-testing) - [To run a local OWASP scan](#to-run-a-local-owasp-scan) + - [End-to-end testing](#end-to-end-testing) - [Deploying](#deploying) - [Egress Proxy](#egress-proxy) - [Managing environment variables](#managing-environment-variables) @@ -307,6 +308,37 @@ The equivalent command if you are running the API locally: docker run -v $(pwd):/zap/wrk/:rw -t owasp/zap2docker-weekly zap-api-scan.py -t http://host.docker.internal:6011/docs/openapi.yml -f openapi -c zap.conf -r report.html ``` +## End-to-end Testing + +In order to run end-to-end (E2E) tests, which are managed and handled in the +admin project, a bit of extra configuration needs to be accounted for here on +the API side as well. These instructions are in the README as they are +necessary for project setup, and they're copied here for reference. + +In the `.env` file, you should see this section: + +``` +############################################################# + +# E2E Testing + +NOTIFY_E2E_TEST_EMAIL=example@fake.gov +NOTIFY_E2E_TEST_PASSWORD="don't write secrets to the sample file" +``` + +You can leave the email address alone or change it to something else to your +liking. + +**You should absolutely change the `NOTIFY_E2E_TEST_PASSWORD` environment +variable to something else, preferably a lengthy passphrase.** + +With those two environment variable set, the database migrations will run +properly and an E2E test user will be ready to go for use in the admin project. + +_Note: Whatever you set these two environment variables to, you'll need to +match their values on the admin side. Please see the admin README and +documentation for more details._ + # Deploying The API has 3 deployment environments, all of which deploy to cloud.gov: