Skip to content
Snippets Groups Projects
Commit 0cc8dc06 authored by Andrej Zabka's avatar Andrej Zabka
Browse files

Updated locust scenario to accept/reject random applications and added note to readme

parent 9220af59
No related branches found
No related tags found
2 merge requests!54Merge develop into main,!50feat(Scenario): Added runnable scenario
Pipeline #
......@@ -216,6 +216,10 @@ Also feel free to monitor the system through grafana during all the following st
If you followed step 1, you (as a manager) should also get an e-mail notification about
new component being created.
*Note: It is possible to time-out our team's e-mail address if you make too many new notifications (for example during the second scenario - load test).
So if the Notifications module is not working, try to wait a few minutes, maybe another reviewer
was doing a load test at the same time. In real system we would not use a regular Gmail address for such job - there would be no timeouts.*
#### 4. Log in as an manager and create a visualization of a car
- Log in using a manager scope (test_5), same way as before.
- Now, you can perform all operations, except POST at /carComponent (only engineers can do that).
......
from locust import HttpUser, task
import random
class Admin(HttpUser):
id = 0
fixed_count = 1
def on_start(self):
@task
def update_random_application_status(self):
response = self.client.get("/application")
if len(response.json()) == 0:
self.client.post("/application", json={
"name": "Jozko",
"surname": "Example",
"birthday": "2023-05-06",
"email": "jozko.example@example.com"
})
response = self.client.get("/application")
return
self.id = response.json()[0]['id']
@task
def update_application_status(self):
self.client.get("/application")
applicationNumber = random.choice([i for i in range(1, len(response.json()))])
status = random.choice(["accepted", "rejected"])
self.client.put(f"/application/status?id={self.id}&applicationStatus={status}")
self.client.put(f"/application/status?id={applicationNumber}&applicationStatus={status}")
@task
def get_application(self):
......@@ -41,6 +30,6 @@ class User(HttpUser):
self.client.post("/application", json={
"name": "Jozko",
"surname": "Example",
"birthday": "2023-05-06",
"email": "jozko.example@example.com"
"birthday": "2000-05-06",
"email": "john@example.com"
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment