From 4770e61e0e9b2045bd1110d6bf843eccd1133570 Mon Sep 17 00:00:00 2001 From: Pablo Parada Date: Wed, 27 Mar 2024 13:23:32 +0100 Subject: [PATCH 1/2] fix: update parsed_options run_time --- locust/web.py | 1 + 1 file changed, 1 insertion(+) diff --git a/locust/web.py b/locust/web.py index 1495fc032d..2334e7c595 100644 --- a/locust/web.py +++ b/locust/web.py @@ -228,6 +228,7 @@ def swarm() -> Response: continue try: run_time = parse_timespan(value) + parsed_options_dict[key] = run_time except ValueError: err_msg = "Valid run_time formats are : 20, 20s, 3m, 2h, 1h20m, 3h30m10s, etc." logger.error(err_msg) From b2e7f12d1c10b7e59dda97e3a727d0936aecc79c Mon Sep 17 00:00:00 2001 From: Lars Holmberg Date: Wed, 8 May 2024 20:14:45 +0200 Subject: [PATCH 2/2] Promote user count, spawn rate and host to parsed options dict So they can be accessed from LoadTestShapes --- locust/web.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/locust/web.py b/locust/web.py index 2334e7c595..715900280a 100644 --- a/locust/web.py +++ b/locust/web.py @@ -215,11 +215,14 @@ def swarm() -> Response: for key, value in request.form.items(): if key == "user_count": # if we just renamed this field to "users" we wouldn't need this user_count = int(value) + parsed_options_dict["users"] = user_count elif key == "spawn_rate": spawn_rate = float(value) + parsed_options_dict[key] = spawn_rate elif key == "host": # Replace < > to guard against XSS environment.host = str(request.form["host"]).replace("<", "").replace(">", "") + parsed_options_dict[key] = environment.host elif key == "user_classes": # Set environment.parsed_options.user_classes to the selected user_classes parsed_options_dict[key] = request.form.getlist("user_classes")