deer-flow/backend/tests/test_sandbox_prewarm_config.py
Totoro 16d36ccd21
feat(sandbox): add bounded AIO prewarming and lifecycle benchmarks (#6998)
* fix(benchmark): validate sandbox lifecycle and concurrent measurements

* feat(sandbox): prewarm likely AIO tool turns

(cherry picked from commit 3a1017ed032ed9331987bc3dc61f23dcdac4e905)

* fix(sandbox): bind bounded prewarming to execution leases

* docs: trim frontend guidance below its existing size limit

* fix(benchmark): separate failed lifecycle stage timings

* test(sandbox): measure prewarm overlap and unused resources through agent graphs

* fix(sandbox): finish lease and sampler cleanup after cancellation or errors

* docs(benchmark): distinguish initialization wait from model overlap

* docs(helm): align the configuration example with version 61

* fix(sandbox): preserve synchronous agent graphs when prewarming is enabled

* test(cargo): isolate native fixtures from inherited make jobserver flags

* fix(sandbox): require managed cleanup before prewarming

* fix(sandbox): log denied prewarming as an expected skip

* fix(benchmark): filter provider summary input records

---------

Co-authored-by: nothingyuancando <1579035512@qq.com>
2026-10-18 08:10:56 +08:00

25 lines
929 B
Python

"""Operator controls bound speculative sandbox work without enabling it by default."""
import pytest
from pydantic import ValidationError
from deerflow.config.sandbox_config import SandboxConfig
def test_prewarm_defaults_are_opt_in_and_bounded():
config = SandboxConfig(use="deerflow.community.aio_sandbox:AioSandboxProvider")
assert config.prewarm is False
assert config.prewarm_max_concurrent == 1
@pytest.mark.parametrize("value", [1, 4, "3"])
def test_prewarm_limit_accepts_positive_integers_and_environment_strings(value):
config = SandboxConfig(use="example:Provider", prewarm_max_concurrent=value)
assert config.prewarm_max_concurrent == int(value)
@pytest.mark.parametrize("value", [True, False, 0, -1, 1.5, "bad", None])
def test_prewarm_limit_rejects_invalid_values(value):
with pytest.raises(ValidationError):
SandboxConfig(use="example:Provider", prewarm_max_concurrent=value)