Locust: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 26: Line 26:
from locust import HttpUser, task
from locust import HttpUser, task


class HelloWorldUser(HttpUser):
class HealthCheck(HttpUser):
     @task
     @task
     def hello_world(self):
     def hello_world(self):

Revision as of 19:02, 20 January 2024

python3 -m venv ~/.venv/locust --prompt="Locust"
source ~/.venv/locust/bin/activate
pip install locust
locust -V

Playground

mkdir -p ~/Documents/locust-playground
cd       ~/Documents/locust-playground





locust
open http://localhost:8089 &>/dev/null
cat <<'EOF' > ~/Documents/locust-playground/locustfile.py
from locust import HttpUser, task

class HealthCheck(HttpUser):
    @task
    def hello_world(self):
        self.client.get("/services/audit/health")
        self.client.get("/services/quote/health")
EOF

References