From 8521968894c792e29da3d90d3aaf5cb73be7b07b Mon Sep 17 00:00:00 2001 From: Eliise S Date: Thu, 5 Mar 2020 11:41:19 +0000 Subject: [PATCH] Update docs --- Makefile | 9 ++++++--- azure-pipelines.yaml | 2 +- docs/locust.md | 25 ++++++------------------- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index a0df7bb..52a447e 100644 --- a/Makefile +++ b/Makefile @@ -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)" @@ -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 \ No newline at end of file +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') diff --git a/azure-pipelines.yaml b/azure-pipelines.yaml index 28bf5fe..81f2919 100644 --- a/azure-pipelines.yaml +++ b/azure-pipelines.yaml @@ -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() diff --git a/docs/locust.md b/docs/locust.md index 850ba65..9f25a70 100644 --- a/docs/locust.md +++ b/docs/locust.md @@ -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 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 with the below credentials to view the Grafana dashboards ```text Username: admin @@ -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/.py - ``` - #### Set error conditions For some of the load test scenarios we want to trigger error behaviour in the mockAPI during a test run. @@ -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. \ No newline at end of file +- 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.