diff --git a/components/core/requirements.txt b/components/core/requirements.txt index eb2cec62..ff630641 100644 --- a/components/core/requirements.txt +++ b/components/core/requirements.txt @@ -7,9 +7,10 @@ greenlet==0.4.15 itsdangerous==0.24 Jinja2==2.8 MarkupSafe==0.23 -mysqlclient==1.3.7 +mysqlclient==1.3.11 six==1.10.0 websocket-client==0.37 Werkzeug==0.11.4 SQLAlchemy==1.1.9 -gunicorn==19.9.0 \ No newline at end of file +gunicorn==19.9.0 +minio==5.0.5 \ No newline at end of file diff --git a/locustfile.py b/locustfile.py new file mode 100644 index 00000000..b6cfc3ea --- /dev/null +++ b/locustfile.py @@ -0,0 +1,36 @@ +from locust import HttpLocust, TaskSet, task, between +from random import randint + +USERNAME = "rand" +PASSWORD = "pass" +SERVER_SECRET_KEY = "123456789" + +class UserBehavior(TaskSet): + headers = { + 'Host': 'localhost:5000', + 'Accept': 'application/json, text/plain, */*', + 'Accept-Language': 'en-US,en;q=0.5', + 'Accept-Encoding': 'gzip, deflate', + 'Content-Type': 'application/x-www-form-urlencoded', + 'Origin': 'http://localhost:3000', + } + + def on_start(self): + res = self.client.post("/api/login", "user_name={}&password={}".format(USERNAME, PASSWORD), headers=self.headers) + self.headers['token'] = res.headers['token'] + + @task(1) + def get_user_signup_requests(self): + self.client.get("/api/user/requests", headers=self.headers) + + @task(1) + def get_blocked_users_request(self): + self.client.get("/api/user/blocked", headers=self.headers) + + @task(1) + def get_downloads_user_request(self): + self.client.get("/api/user/downloads/" + str([50, 100, 150][randint(0, 2)]), headers=self.headers) + +class APIUser(HttpLocust): + task_set = UserBehavior + wait_time = between(2, 7)