Some checks failed
CI / test (push) Failing after 45s
被评数字员工响应普遍逼近 30s 硬编码轮询超时,越线的轮次被记为无回复 (run 427b14bb round 2 实测 31.4s 超时)。新增 AGENTEVAL_POLL_REPLY_TIMEOUT(默认 30s),engine 未显式传入 timeout_config 时从 settings 取值,慢目标可放宽。
48 lines
1.5 KiB
Python
48 lines
1.5 KiB
Python
"""Tests for Settings auto-derivation of openclaw_ws_origin."""
|
|
|
|
from agenteval.config.settings import Settings
|
|
|
|
|
|
def test_explicit_openclaw_ws_origin_is_preserved():
|
|
s = Settings(
|
|
openclaw_ws_origin="http://explicit.example",
|
|
allowed_origins=["http://other.example"],
|
|
)
|
|
assert s.openclaw_ws_origin == "http://explicit.example"
|
|
|
|
|
|
def test_derived_from_single_non_wildcard_origin():
|
|
s = Settings(allowed_origins=["http://192.168.8.145:8001"])
|
|
assert s.openclaw_ws_origin == "http://192.168.8.145:8001"
|
|
|
|
|
|
def test_derived_picks_first_non_localhost_origin():
|
|
s = Settings(allowed_origins=[
|
|
"http://localhost:5173",
|
|
"http://127.0.0.1:8001",
|
|
"http://192.168.8.145:8001",
|
|
"http://agenteval:8000",
|
|
])
|
|
assert s.openclaw_ws_origin == "http://192.168.8.145:8001"
|
|
|
|
|
|
def test_derived_skips_wildcard():
|
|
s = Settings(allowed_origins=["*", "http://example.com"])
|
|
assert s.openclaw_ws_origin == "http://example.com"
|
|
|
|
|
|
def test_derived_falls_back_when_only_wildcard():
|
|
s = Settings(allowed_origins=["*"])
|
|
assert s.openclaw_ws_origin == "http://localhost:8000"
|
|
|
|
|
|
def test_derived_falls_back_when_empty():
|
|
s = Settings(allowed_origins=[])
|
|
assert s.openclaw_ws_origin == "http://localhost:8000"
|
|
|
|
|
|
def test_poll_reply_timeout_default_and_env(monkeypatch):
|
|
assert Settings().poll_reply_timeout == 30.0
|
|
monkeypatch.setenv("AGENTEVAL_POLL_REPLY_TIMEOUT", "60")
|
|
assert Settings().poll_reply_timeout == 60.0
|