From 491576dfa0e4880aaa69517f8fe04aed910d97c6 Mon Sep 17 00:00:00 2001 From: adrienaflalo <66447890+adrienaflalo@users.noreply.github.com> Date: Mon, 12 Oct 2020 22:33:58 +0200 Subject: [PATCH] Updated loadgenerator to support locust 1.0.2 (#357) * updated loadgenerator to support locust 1.0.2 * removed rate parameter --- src/loadgenerator/loadgen.sh | 2 +- src/loadgenerator/locustfile.py | 6 +++--- src/loadgenerator/requirements.in | 2 +- src/loadgenerator/requirements.txt | 32 +++++++++++++++++++----------- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/loadgenerator/loadgen.sh b/src/loadgenerator/loadgen.sh index 4a0f35e..e36c06f 100755 --- a/src/loadgenerator/loadgen.sh +++ b/src/loadgenerator/loadgen.sh @@ -32,4 +32,4 @@ if test $STATUSCODE -ne 200; then fi # else, run loadgen -locust --host="http://${FRONTEND_ADDR}" --no-web -c "${USERS:-10}" 2>&1 +locust --host="http://${FRONTEND_ADDR}" --headless -u "${USERS:-10}" 2>&1 diff --git a/src/loadgenerator/locustfile.py b/src/loadgenerator/locustfile.py index b134538..7874fc7 100644 --- a/src/loadgenerator/locustfile.py +++ b/src/loadgenerator/locustfile.py @@ -15,7 +15,7 @@ # limitations under the License. import random -from locust import HttpLocust, TaskSet, between +from locust import HttpUser, TaskSet, between products = [ '0PUK6V6EV0', @@ -76,6 +76,6 @@ class UserBehavior(TaskSet): viewCart: 3, checkout: 1} -class WebsiteUser(HttpLocust): - task_set = UserBehavior +class WebsiteUser(HttpUser): + tasks = [UserBehavior] wait_time = between(1, 10) diff --git a/src/loadgenerator/requirements.in b/src/loadgenerator/requirements.in index f6b572c..c3a419f 100644 --- a/src/loadgenerator/requirements.in +++ b/src/loadgenerator/requirements.in @@ -1 +1 @@ -locustio==0.13.0 +locust==1.0.2 diff --git a/src/loadgenerator/requirements.txt b/src/loadgenerator/requirements.txt index 7cd1fc2..2532c43 100644 --- a/src/loadgenerator/requirements.txt +++ b/src/loadgenerator/requirements.txt @@ -2,23 +2,31 @@ # This file is autogenerated by pip-compile # To update, run: # -# pip-compile --output-file requirements.txt requirements.in +# pip-compile --output-file=requirements.txt requirements.in # -certifi==2018.11.29 # via geventhttpclient-wheels, requests +certifi==2018.11.29 # via geventhttpclient, requests chardet==3.0.4 # via requests click==7.0 # via flask -flask==1.0.2 # via locustio -gevent==1.4.0 # via geventhttpclient-wheels, locustio -geventhttpclient-wheels==1.3.1.dev2 # via locustio +configargparse==1.2.3 # via locust +flask-basicauth==0.2.0 # via locust +flask==1.1.2 # via flask-basicauth, locust +gevent==20.5.2 # via geventhttpclient, locust +geventhttpclient==1.4.2 # via locust greenlet==0.4.15 # via gevent idna==2.8 # via requests itsdangerous==1.1.0 # via flask -jinja2==2.10 # via flask -locustio==0.13.0 # via -r requirements.in +jinja2==2.11.2 # via flask +locust==1.0.2 # via -r requirements.in markupsafe==1.1.0 # via jinja2 -msgpack-python==0.5.6 # via locustio -pyzmq==17.0.0 # via locustio -requests==2.21.0 # via locustio -six==1.12.0 # via geventhttpclient-wheels, locustio +msgpack==1.0.0 # via locust +psutil==5.7.0 # via locust +pyzmq==17.0.0 # via locust +requests==2.21.0 # via locust +six==1.12.0 # via geventhttpclient urllib3==1.24.2 # via requests -werkzeug==0.14.1 # via flask +werkzeug==1.0.1 # via flask +zope.event==4.4 # via gevent +zope.interface==5.1.0 # via gevent + +# The following packages are considered to be unsafe in a requirements file: +# setuptools