Skip to content

Instantly share code, notes, and snippets.

@lauriku lauriku/locustfile.py Secret
Last active Mar 8, 2016

Embed
What would you like to do?
from locust import HttpLocust, TaskSet, task
class UserBehavior(TaskSet):
def on_start(self):
self.query1 = {"q": "select * from temperature where (device_id = '10001' or
device_id = '10002' or device_id = '10003' or device_id = '10004' or
device_id = '10005') and time > now() - 6h",
"db": "load_testing"}
self.query2 = {"q": "select last(value) from /.*/ where time > NOW() - 1m group by *",
"db": "load_testing"}
@task(1)
def get_latest_data(self):
self.client.get("/query", params=self.query1,
name="Select 6h of data from temperature for 5 devices")
@task(1)
def get_latest_data_for_all_devices(self):
self.client.get("/query", params=self.query2,
name= "Select last value from all measurements for all devices")
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait=1000
max_wait=3000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.