From 1ab2ee68affc14dd4409512a8cb6587aac24637c Mon Sep 17 00:00:00 2001 From: Steve Waterworth Date: Tue, 23 Jun 2020 10:37:11 +0100 Subject: [PATCH] locust breaking changes --- load-gen/entrypoint.sh | 4 ++-- load-gen/requirements.txt | 2 +- load-gen/robot-shop.py | 10 ++++------ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/load-gen/entrypoint.sh b/load-gen/entrypoint.sh index 5334455..aa56a03 100755 --- a/load-gen/entrypoint.sh +++ b/load-gen/entrypoint.sh @@ -38,8 +38,8 @@ fi echo "Starting $CLIENTS clients for ${RUN_TIME:-ever}" if [ "$SILENT" -eq 1 ] then - locust -f robot-shop.py --host "$HOST" --no-web -r 1 -c $NUM_CLIENTS $TIME > /dev/null 2>&1 + locust -f robot-shop.py --host "$HOST" --headless -r 1 -u $NUM_CLIENTS $TIME > /dev/null 2>&1 else - locust -f robot-shop.py --host "$HOST" --no-web -r 1 -c $NUM_CLIENTS $TIME + locust -f robot-shop.py --host "$HOST" --headless -r 1 -u $NUM_CLIENTS $TIME fi diff --git a/load-gen/requirements.txt b/load-gen/requirements.txt index 282a9af..8eaebfd 100644 --- a/load-gen/requirements.txt +++ b/load-gen/requirements.txt @@ -1 +1 @@ -locustio +locust diff --git a/load-gen/robot-shop.py b/load-gen/robot-shop.py index a2f0807..5d3a95f 100644 --- a/load-gen/robot-shop.py +++ b/load-gen/robot-shop.py @@ -1,9 +1,11 @@ import os -from locust import HttpLocust, TaskSet, task +from locust import HttpUser, task, between from random import choice from random import randint -class UserBehavior(TaskSet): +class UserBehavior(HttpUser): + wait_time = between(2, 10) + def on_start(self): """ on_start is called when a Locust start before any task is scheduled """ print('Starting') @@ -69,7 +71,3 @@ class UserBehavior(TaskSet): self.client.post('/api/payment/pay/partner-57', json=cart) -class WebsiteUser(HttpLocust): - task_set = UserBehavior - min_wait = 1000 - max_wait = 5000