Skip to content

Commit

Permalink
change README
Browse files Browse the repository at this point in the history
  • Loading branch information
sastels committed Oct 24, 2023
1 parent 1d5a824 commit ed971c8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions scripts/soak_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
The goal of this code is to do a soak test of api while we make significant application or infrastructure changes.

There are two soak tests here:
- `soak_test_send_email.py` will POST an email to api every second.
- `soak_test_send_notification.py` will POST an email or SMS to api every second.
- `soak_test_all_servers.py` will do a GET to all our servers (admin, api, dd-api, api-k8s, documentation), on average hitting each server once a second

## How to configure
Expand All @@ -14,19 +14,21 @@ Run the setup.sh to install the python pre-requisites or run in the repo devcont

Default configuration is in the `locust.conf` file. Note that the `host` is the base address of the system you are testing, for example `https://staging.notification.cdssandbox.xyz` **not** `https://api.staging.notification.cdssandbox.xyz`. The "api" prefix will be added in the code.

The python file `soak_test_send_email.py` requires environment variables `API_KEY` and `EMAIL_TEMPLATE_ID`. The template should have no variables.
The python file `soak_test_send_notification.py` requires environment variables `API_KEY`, `EMAIL_TEMPLATE_ID`, and `SMS_TEMPLATE_ID` . The template should have no personalisation variables.

```
API_KEY=gcntfy-notAKey-f6c7cc49-b5b7-4e67-a8ff-24f34be34523-f6c7cc49-b5b7-4e67-a8ff-24f34be34523
EMAIL_TEMPLATE_ID=f6c7cc49-b5b7-4e67-a8ff-24f34be34523
SMS_TEMPLATE_ID=f6c7cc49-b5b7-4e67-aeef-24f34be34523
```
These can be in a `.env` file in the soak_test directory.

__See Last Pass note "Soak Test Staging API Key and Template" in Shared-New-Notify-Staging folder__

Note that the default configuration in `locust.conf` is to send one email per second.

You can supply a `--ref` option to `soak_test_send_email.py` that will set the notification's `client_reference`. This is useful in testing that all POSTs were processed successfully.
Notes:
- The default configuration in `locust.conf` is to send one email per second.
- You can supply a `--ref` option to `soak_test_send_notification.py` that will set the notification's `client_reference`. This is useful in testing that all POSTs were processed successfully.
- You can also supply a `--type` option that will allow you to choose between `email` and `sms` (default is `email`)

## How to run

Expand All @@ -37,7 +39,7 @@ There are two ways to run Locust, with the UI or headless.
Locally you can run the email soak test with:

```shell
locust -f ./soak_test_send_email.py --ref=soak-2023-05-30-A
locust -f ./soak_test_send_notification.py --ref=soak-2023-05-30-A
```

Follow the localhost address that the console will display to get to the UI. It will ask you how many total users and spawned users you want configured. Once setup, you can manually start the tests via the UI and follow the summary data and charts visually.
Expand All @@ -53,7 +55,7 @@ locust -f ./soak_test_all_servers.py
You can pass the necessary parameters to the command line to run in the headless mode. For example:

```shell
locust -f ./soak_test_send_email.py --headless --ref=soak-2023-05-30-A
locust -f ./soak_test_send_notification.py --headless --ref=soak-2023-05-30-A
```

The defaults in `locust.conf` may be overridden by command line options
Expand All @@ -64,9 +66,9 @@ The server soak test can be run with
locust -f ./soak_test_all_servers.py --headless
```

## Checking if all emails were sent
## Checking if all notifications were sent

To check whether all the POSTs from `soak_test_send_email.py` made it into the database, run the "Soak test" query on blazer. The query is already in staging, or you can run:
To check whether all the POSTs from `soak_test_send_notification.py` made it into the database, run the "Soak test" query on blazer. The query is already in staging, or you can run:

```sql
WITH
Expand Down

0 comments on commit ed971c8

Please sign in to comment.