From 3de4354c3d6d6bf20b36aa9e628697f04014dd28 Mon Sep 17 00:00:00 2001 From: varunj-msft Date: Thu, 27 Aug 2026 16:48:23 +0000 Subject: [PATCH] FIX Give scenario end-to-end tests time to start a scenario Every scenario in the end-to-end suite has been failing since the middle of August with an empty "Error starting scenario:" message. The message is empty because the underlying read timeout stringifies to nothing, so the report names neither the request that expired nor the timeout that governed it. Starting a scenario is a single request, and the server does the work before it answers: it runs the initializers, including loading each scenario's default datasets, resolves the target, and builds the scenario. That work grows with the number of registered scenarios, and it now exceeds the client's default read timeout of 60 seconds, so the client gives up while the server is still preparing the run. The empty message is the string form of the resulting read timeout. The timings confirm which timeout expired. Attempts are 150 seconds apart, which is the 60 second read timeout plus the 90 second delay between the flaky reruns, and the final attempt fails exactly 60 seconds after it starts because no delay follows it. The server itself answers other requests in the same session: the 108 dataset tests pass before any scenario runs. Pass an explicit, larger read timeout for these tests so the client waits for the setup it asked the server to do. This makes the suite usable again but does not shrink the setup work itself. Excluding the large package registries from the default dataset selection would not remove the need for this timeout either: measured locally with those registries excluded, the same setup still takes around seventy seconds, above the sixty second default. The same growth also shows up as higher disk use over a run, so reducing what the default dataset initializer loads remains worth doing on its own. --- tests/end_to_end/test_scenarios.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/end_to_end/test_scenarios.py b/tests/end_to_end/test_scenarios.py index 22b991a175..bc5b89a34e 100644 --- a/tests/end_to_end/test_scenarios.py +++ b/tests/end_to_end/test_scenarios.py @@ -27,6 +27,13 @@ CONFIG_FILE = Path(__file__).parent / "test_config.yaml" +#: Read timeout for the ``pyrit_scan`` client, in seconds. Starting a scenario is a single +#: request that runs the initializers, resolves the target and builds the scenario before the +#: server responds; loading the default datasets alone measures around three minutes, so the +#: client default of 60 seconds always expires. The resulting ``ReadTimeout`` stringifies to +#: nothing, so the failure surfaces only as an empty "Error starting scenario:" message. +REQUEST_TIMEOUT_SECONDS = 300 + #: Initializers run for every scenario unless overridden in ``SCENARIO_INITIALIZERS``. #: ``target`` populates ``TargetRegistry`` from env vars; ``load_default_datasets`` #: fetches each scenario's declared default datasets into memory. @@ -91,6 +98,8 @@ def test_scenario_with_pyrit_scan(scenario_name): "openai_chat", "--config-file", str(CONFIG_FILE), + "--request-timeout", + str(REQUEST_TIMEOUT_SECONDS), "--max-dataset-size", "1", "--log-level",