deer-flow/backend/tests/test_scheduler_config.py
Aleksandr Sapronov 613b90b0e6
feat(scheduler): make scheduled-run recursion_limit configurable (#4848)
Adds scheduler.recursion_limit to config.yaml (default 1000, clamped by
max_recursion_limit) so scheduled background runs can use a different
recursion limit than the web UI. The value is read at dispatch time, so
a YAML edit applies to the next scheduled run without a Gateway restart.

Also logs a warning when the resolver falls back to the default or
clamps the configured value.
2026-08-24 07:09:08 +08:00

27 lines
745 B
Python

"""Tests for SchedulerConfig schema."""
import pytest
from pydantic import ValidationError
from deerflow.config.scheduler_config import SchedulerConfig
def test_scheduler_config_defaults():
config = SchedulerConfig()
assert config.enabled is False
assert config.recursion_limit == 1000
def test_scheduler_config_accepts_positive_recursion_limit():
assert SchedulerConfig(recursion_limit=1).recursion_limit == 1
assert SchedulerConfig(recursion_limit=1000).recursion_limit == 1000
def test_scheduler_config_rejects_non_positive_recursion_limit():
with pytest.raises(ValidationError):
SchedulerConfig(recursion_limit=0)
with pytest.raises(ValidationError):
SchedulerConfig(recursion_limit=-5)