reworked structure and improved performance to handle 500 concurrent users

This commit is contained in:
2026-02-20 18:31:16 +01:00
parent 7226c0c698
commit f192355ec6
21 changed files with 1535 additions and 386 deletions

27
test/locustfile.py Normal file
View File

@@ -0,0 +1,27 @@
from locust import HttpUser, task, between
import random
class StudentUser(HttpUser):
wait_time = between(1, 10)
def on_start(self):
# Register a user and get a cookie
username = f"testuser_{random.randint(1, 100000)}"
self.client.post("/register", data={
"username": username,
"acknowledge": "on"
})
self.client.post("/access", data={"password": "locust"})
@task(5)
def view_index(self):
self.client.get("/")
@task(1)
def enter_password(self):
self.client.post("/access", data={"password": "locust_test"})
@task(3)
def view_slide(self):
# Simulate loading slide files
self.client.get("/slides/itsec2526/tut-01/index.html")