Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
EliiseS committed Mar 5, 2020
1 parent 025ab46 commit 8521968
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 23 deletions.
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,6 @@ deploy-mock-api:kind-load-image-mock-api apply-manifests-mock-api

kind-deploy-mock-api: create-kindcluster install-prometheus deploy-mock-api

# Args passed to locust must be in CSV format as passed in "command" section of yaml doc
LOCUST_ARGS?=,'--no-web', '-c', '25', '-r', '0.08'
deploy-locust:
@echo "$(shell tput setaf 10)$(shell tput bold)Deploying Locust $(shell tput sgr0)"

Expand Down Expand Up @@ -302,5 +300,10 @@ deploy-cluster-for-load-testing: create-kindcluster install-prometheus create-db

run-load-testing: deploy-cluster-for-load-testing deploy-locust port-forward
@echo "$(shell tput setaf 10)$(shell tput bold)Verify load tests $(shell tput sgr0)"
go run hack/verify_load_tests/main.go

go run hack/verify_load_tests/main.go
run-load-testing-auto-start: set-auto-start run-load-testing

set-auto-start:
# Args passed to locust must be in CSV format as passed in "command" section of yaml doc
$(eval LOCUST_ARGS=,'--no-web', '-c', '25', '-r', '0.08')
2 changes: 1 addition & 1 deletion azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
echo "-------> Building code and running tests"
# Run `make` to build and test the code
docker run -v $(System.DefaultWorkingDirectory)/.gocache:/go/pkg/ -v /var/run/docker.sock:/var/run/docker.sock -v $(System.DefaultWorkingDirectory):/src --workdir /src --entrypoint /bin/bash --network="host" --env DATABRICKS_HOST=$(DATABRICKS_HOST) --env DATABRICKS_TOKEN=$(DATABRICKS_TOKEN) devcontainer -c "make test; make run-load-testing"
docker run -v $(System.DefaultWorkingDirectory)/.gocache:/go/pkg/ -v /var/run/docker.sock:/var/run/docker.sock -v $(System.DefaultWorkingDirectory):/src --workdir /src --entrypoint /bin/bash --network="host" --env DATABRICKS_HOST=$(DATABRICKS_HOST) --env DATABRICKS_TOKEN=$(DATABRICKS_TOKEN) devcontainer -c "make test; make run-load-testing-auto-start"
sudo chown -R $USER $(System.DefaultWorkingDirectory)
condition: succeeded()
Expand Down
25 changes: 6 additions & 19 deletions docs/locust.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,16 @@ Tests are written using `pytest`. More information [is available here](https://d

> Before proceeding make sure your container or environment is up and running

1. Deploy locust to local KIND instance. Set `LOCUST_FILE` to the the locust scenario you'd like to run from `locust/behaviours`.
1. Deploy load testing to local KIND instance and port-forward.
- Set `LOCUST_FILE` to the the locust scenario you'd like to run from `locust/behaviours`. Defaults to `"behaviours/scenario1_run_submit_delete.py"`
```bash
make run-load-testing LOCUST_FILE="behaviours/scenario1_run_submit_delete.py" LOCUST_ARGS=
make run-load-testing LOCUST_FILE="behaviours/scenario1_run_submit_delete.py"
```
2. Once all services are up, port-forward them for access
2. Navigate to <http://localhost:8089> to start the load test from the locust web UI
```bash
make port-forward
```
3. Navigate to http://localhost:8089 to start the load test from the locust web UI
4. Navigate to http://localhost:8080 with the below credentials to view the Grafana dashboards
3. Navigate to <http://localhost:8080> with the below credentials to view the Grafana dashboards
```text
Username: admin
Expand All @@ -86,14 +81,6 @@ Tests are written using `pytest`. More information [is available here](https://d
> Note: If one of these port-forwards stops working use `ps aux | grep kubectl` and look for the process id of the one thats broken then use `kill 21283` (your id in there) to stop it. Then rerun the port-forward command
Good to know:
- Change the load test scenario file after deploying with:
```bash
locust -f behaviours/<my_locust_file>.py
```
#### Set error conditions
For some of the load test scenarios we want to trigger error behaviour in the mockAPI during a test run.
Expand Down Expand Up @@ -151,4 +138,4 @@ The endpoint is exposed at `/export/prometheus`. When running the tests with the

## Known issues

- When the port you're forwarding your Locust server to is not exposed from the container, you cannot hit it from your localhost machine. Use the [VSCode temporary port-forwarding](https://code.visualstudio.com/docs/remote/containers#_temporarily-forwarding-a-port) to resolve this.
- When the port you're forwarding your Locust server to is not exposed from the container, you cannot hit it from your localhost machine. Use the [VSCode temporary port-forwarding](https://code.visualstudio.com/docs/remote/containers#_temporarily-forwarding-a-port) to resolve this.

0 comments on commit 8521968

Please sign in to comment.