-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocustfile.py
29 lines (26 loc) · 974 Bytes
/
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
from locust import HttpUser, task
class BFFUser(HttpUser):
@task
def do_client_server_interaction(self):
headers = {
"Content-Type": "application/json"
}
"""
The "resource" key specify the feature on the server application.
The "request_quantity" key specify the number of requests to be made to the server.
"""
payload = {
"resource": "getByDiscount",
"request_quantity": 1
}
"""
The /interact/<method> endpoint is used trigger BFF and specified server.
The options to /interact/<method> are http|grpc|rabbitmq
"""
res = self.client.post("/interact/grpc", json=payload, headers=headers)
"""
The response content will be printed to the console.
Contains useful info for debugging.
"""
print(f"Status Code: {res.status_code}")
print(f"Response Content: {res.content}")