docker run --rm -p 8089:8089 -e LOCUST_MODE=master -e TARGET_HOST=http://concourse.udcp.info -e LOCUST_SCRIPT=/locust-tasks/locust.py -v $(pwd):/locust-tasks greenbirdit/locust:0.9.0
Created
February 4, 2020 06:06
-
-
Save jacopen/9d42b445a2c9d59e999f5c4d8d8c64a8 to your computer and use it in GitHub Desktop.
Locust memo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
master: | |
image: greenbirdit/locust:0.9.0 | |
environment: | |
- "LOCUST_MODE=master" | |
- "TARGET_HOST=http://site.example.com" | |
- "LOCUST_SCRIPT=/locust-tasks/tasks.py" | |
volumes: | |
- ./app/locust-tasks/tasks.py:/locust-tasks/tasks.py | |
networks: | |
locust-nw: | |
ports: | |
- "8089:8089" | |
worker: | |
image: greenbirdit/locust:0.9.0 | |
environment: | |
- "LOCUST_MODE=worker" | |
- "LOCUST_MASTER=master" | |
- "LOCUST_MASTER_WEB=8089" | |
- "TARGET_HOST=http://site.example.com" | |
- "LOCUST_SCRIPT=/locust-tasks/tasks.py" | |
volumes: | |
- ./app/locust-tasks/tasks.py:/locust-tasks/tasks.py | |
networks: | |
locust-nw: | |
networks: | |
locust-nw |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from locust import HttpLocust, TaskSet, between | |
def login(l): | |
l.client.post("/login", {"username":"ellen_key", "password":"education"}) | |
def logout(l): | |
l.client.post("/logout", {"username":"ellen_key", "password":"education"}) | |
def index(l): | |
l.client.get("/") | |
def profile(l): | |
l.client.get("/info") | |
class UserBehavior(TaskSet): | |
tasks = {index: 2, profile: 1} | |
def on_start(self): | |
print("hoge") | |
def on_stop(self): | |
print("hoge") | |
class WebsiteUser(HttpLocust): | |
task_set = UserBehavior | |
wait_time = between(5.0, 9.0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment