opnsense-ports/benchmarks/py-locust/files/extra-EXAMPLES-basic.py
Franco Fichtner 38f38f6cef */*: sync with upstream
Taken from: HardenedBSD
2019-01-20 14:45:08 +01:00

26 lines
606 B
Python

from locust import HttpLocust, TaskSet, task
def index(l):
l.client.get("/")
def stats(l):
l.client.get("/stats/requests")
class UserTasks(TaskSet):
# one can specify tasks like this
tasks = [index, stats]
# but it might be convenient to use the @task decorator
@task
def page404(self):
self.client.get("/does_not_exist")
class WebsiteUser(HttpLocust):
"""
Locust user class that does requests to the locust web server running on localhost
"""
host = "http://127.0.0.1:8089"
min_wait = 2000
max_wait = 5000
task_set = UserTasks