1234567891011121314151617181920212223 |
- import random
- from locust import HttpUser, task, between
- class QuickstartUser(HttpUser):
- wait_time = between(5, 9)
- @task(10)
- def health_page(self):
- self.client.get("/health")
- @task(100)
- def timer_page(self):
- rand_start = random.randint(1, 1000)
- rand_end = random.randint(1000, 20000)
- self.client.get(f"/timer/{rand_start}/{rand_end}", name="/timer")
- @task(100)
- def status_page(self):
- codes = [ "301", "302", "404", "500", "503" ]
- seed = random.randint(0, len(codes)-1)
- self.client.get(f"/status/{codes[seed]}", name="/status")
|