This branch removes the need for the keyvault and uses local state storage. Simple instructions:
cd src/testing/infra
terraform init
terraform apply --var 'locustWorkerNodes=5' --var 'prefix=navops'
# Enter 'yes' when prompted if everything looks good
.
.
.
Apply complete! Resources: 13 added, 0 changed, 0 destroyed.
Outputs:
locust_webui = "http://locust:QYhCkMMr65_zW%[email protected]:8089/"
Newer versions may output <sensitive>
in the place of a value for locust_webui. Simply run the following command
to see the output values:
terraform output --json
{
"locust_webui": {
"sensitive": true,
"type": "string",
"value": http://locust:QYhCkMMr65_zW%[email protected]:8089/"
}
}
The above commands will create resource group 'locust-navops-rg' and install a master and 5 workers in ACI. The Locust environment can be accessed at the URL returned from terraform.
The locust tests are defined at src/testing/locustfile.py
and can be changed as needed.
The environment can be destroyed with a single command:
terraform destroy --var 'locustWorkerNodes=5' --var 'prefix=navops'
Load testing with Locust using Azure Container Instances (ACI). This repository contains sample implementations in Terraform how to deploy and run load tests with Locust.
This repository contains two different Terraform definitions to deploy Locust:
- headless - To conduct fully automated load tests without a user interface triggered via a GitHub workflow.
- webui - To deploy a load testing infrastructure with multiple worker nodes and a webui to conduct and monitor tests.
The "headless" workflow asks upfront for all required information to conduct the load test:
- Number of Locust worker nodes
- Duration in minutes
- The rate per second in which users are spawned
- Number of concurrent Locust users
- Locust target URL
The workflow will then, based on your selection, deploy the required infrastructure in Azure, conduct the load test as defined, store the results in it's Azure Storage Account and scale down the infrastructure back to 0 - except its Storage Account.
The "webui" workflow spins up a full Locust deployment with the selected number of worker nodes. You can run the same pipeline again to scale the infrastructure down.