Skip to content

Commit

Permalink
feat: teste de carga com locust
Browse files Browse the repository at this point in the history
  • Loading branch information
heltonricardo committed Dec 26, 2023
1 parent eb1b7db commit 851b8ba
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/locustfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from locust import HttpUser, task, between

class ApiLoadRunner(HttpUser):
"""
Sends a POST request to the '/predict' endpoint with a JSON payload.
Args:
self: The instance of the class.
Returns:
None
"""
wait_time = between(0.5, 2.5)

@task
def request(self):
headers = {
"Content-Type": "application/json"
}
request_body = {
"accelerations": 0,
"fetal_movement": 0,
"uterine_contractions": 0,
"severe_decelerations": 0
}
self.client.post('/predict', json=request_body, headers=headers)

0 comments on commit 851b8ba

Please sign in to comment.