-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlocustfile.py
44 lines (38 loc) · 1.47 KB
/
locustfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import locust.stats
from locust import task, between
locust.stats.CONSOLE_STATS_INTERVAL_SEC = 60
# https://docs.locust.io/en/stable/increase-performance.html
from locust.contrib.fasthttp import FastHttpUser
class UserBehavior(FastHttpUser):
wait_time = between(1, 1)
@task
def expectation(self):
self.client.put("/mockserver/expectation",
"[{\n"
" \"httpRequest\": {\n"
" \"path\": \"/simple\"\n"
" },\n"
" \"httpResponse\": {\n"
" \"statusCode\": 200,\n"
" \"body\": \"some simple response\"\n"
" },\n"
" \"times\": {\n"
" \"remainingTimes\": 5\n"
" }\n"
"}]",
verify=False,
headers={
"Connection": "Keep-Alive",
"Keep-Alive": "timeout=120, max=1000"
})
@task
def request(self):
self.client.get("/simple",
verify=False,
headers={
"Connection": "Keep-Alive",
"Keep-Alive": "timeout=120, max=1000"
})
# @task
# def forward(self):
# self.client.get("/forward")