Performance Tests for the Funding Service Design Pre Award Project
NOTE: Running the test locally with python -m locust will no longer work as the data stores are not exposed in AWS. You will need to follow the steps for running the tests via AWS Copilot.
- locust
- AWS Vault: https://dluhcdigital.atlassian.net/wiki/spaces/FS/pages/5241813/Using+AWS+Vault+SSO
- AWS CLI, AWS Copilot: https://dluhcdigital.atlassian.net/wiki/spaces/FS/pages/65339803/AWS+Troubleshooting
- Docker Desktop
Clone the repository
python3 -m venv .venv
...either macOS using bash:
source .venv/bin/activate
...or if on Windows using Command Prompt:
.venv\Scripts\activate.bat
From the top-level directory enter the command to install pip and the dependencies of the project
python3 -m pip install --upgrade pip && pip install -r requirements.txt
Enter the virtual environment as described above, then:
python -m locust
Or to run via AWS Copilot do the below:
Open Docker Desktop
Login to AWS Vault:
aws-vault exec <profile_name>
Run AWS Copilot Task below:
copilot task run --env-vars TARGET_URL_FUND_STORE=http://fsd-fund-store.<env_name>.pre-award.local:8080,TARGET_URL_APPLICATION_STORE=http://fsd-application-store.<env_name>.pre-award.local:8080,TARGET_URL_ASSESSMENT_STORE=http://fsd-assessment-store.<env_name>.pre-award.local:8080 --follow
In which application would you like to run this task? > pre-award
In which environment would you like to run this task? > test
There is a locust config file in the repository that manages how the tests are run and where they are run against. Change the values in there based on the needs of your performance testing. The host can be changed to point at a local running version of the application.
A html report is produced at the end of a run and is stored in the root of the project. This shows the results of the tests.
To add a new performance test you need to add a py file to my_locustfiles containing the performance tests and then add an import to the base locustfile.py in the root of the directory.
Black (https://black.readthedocs.io/en/stable/), flake8 (https://flake8.pycqa.org/en/latest/) and Bandit (https://bandit.readthedocs.io/en/latest/) have been added to staticly check the code