auto-sync: 2026-06-07 08:23:57
Deploy / ci (push) Waiting to run
Deploy / deploy (push) Blocked by required conditions
Deploy / notify-deploy-failure (push) Blocked by required conditions

This commit is contained in:
cfdaily
2026-06-07 08:23:57 +08:00
parent 0d7425b88c
commit 7e1bdec0b2
3 changed files with 100 additions and 20 deletions
+19
View File
@@ -2,6 +2,11 @@ import pytest
pytestmark = pytest.mark.e2e
skip_no_integration = pytest.mark.skipif(
not __import__("os").environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run E2E tests against real daemon",
)
"""v2.7 端到端测试 — 全链路真实环境
覆盖:项目管理 → Task CRUD → SubTask → Stage进度 → 状态聚合 → 依赖链 → 超时 → Mail → 真实Agent调度
@@ -62,6 +67,7 @@ def _tid() -> str:
# E1: 项目管理
# ===================================================================
@skip_no_integration
class TestE1ProjectManagement:
"""E1: 项目创建、列表、归档"""
@@ -117,6 +123,7 @@ class TestE1ProjectManagement:
# E2: Task CRUD + 状态机
# ===================================================================
@skip_no_integration
class TestE2TaskCRUD:
"""E2: Task 创建、查询、状态转换"""
@@ -198,6 +205,7 @@ class TestE2TaskCRUD:
# E3: SubTask 父子关系
# ===================================================================
@skip_no_integration
class TestE3SubTask:
"""E3: 父子 Task 关系"""
@@ -257,6 +265,7 @@ class TestE3SubTask:
# E4: Stage 进度
# ===================================================================
@skip_no_integration
class TestE4StageProgress:
"""E4: stages_json + stage 分组统计"""
@@ -325,6 +334,7 @@ class TestE4StageProgress:
# E5: 父 Task 状态聚合
# ===================================================================
@skip_no_integration
class TestE5ParentAggregation:
"""E5: compute_parent_status 聚合逻辑"""
@@ -418,6 +428,7 @@ class TestE5ParentAggregation:
# E6: 依赖链
# ===================================================================
@skip_no_integration
class TestE6DependencyChain:
"""E6: depends_on 依赖推进"""
@@ -475,6 +486,7 @@ class TestE6DependencyChain:
# E7: 超时回收
# ===================================================================
@skip_no_integration
class TestE7Timeout:
"""E7: claimed/working 超时回收"""
@@ -537,6 +549,7 @@ class TestE7Timeout:
# E8: Mail Tab 6 端点
# ===================================================================
@skip_no_integration
class TestE8MailTab:
"""E8: Mail 端到端"""
@@ -769,6 +782,7 @@ def _poll_task(pid, tid, timeout, terminal_states=None):
@pytest.mark.integration
@pytest.mark.skipif(not os.environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run real agent tests")
@skip_no_integration
class TestE9RealAgentDispatch:
"""E9: 真实 Agent 调度测试
@@ -915,6 +929,7 @@ class TestE9RealAgentDispatch:
@pytest.mark.integration
@pytest.mark.skipif(not os.environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run real agent tests")
@skip_no_integration
class TestE10FullChain:
"""E10: 项目 → 父子Task → 生产Ticker → 聚合 → 依赖 → Mail → 前端API
@@ -1116,6 +1131,7 @@ class TestE10FullChain:
@pytest.mark.integration
@pytest.mark.skipif(not os.environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run real agent tests")
@skip_no_integration
class TestE11AcquireFirstE2E:
"""E11: #07.1 Acquire-First Phase 1-4 真实 Agent E2E
@@ -1284,6 +1300,7 @@ class TestE11AcquireFirstE2E:
@pytest.mark.integration
@pytest.mark.skipif(not os.environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run real agent tests")
@skip_no_integration
class TestE12TimeoutsUnifiedE2E:
"""E12: #07.2 _check_timeouts 统一超时 + crash_limit + updated_at fallback
@@ -1420,6 +1437,7 @@ class TestE12TimeoutsUnifiedE2E:
@pytest.mark.integration
@pytest.mark.skipif(not os.environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run real agent tests")
@skip_no_integration
class TestE13CompactHangingE2E:
"""E13: compact_hanging outcome → 任务保持 working(不标 failed
@@ -1513,6 +1531,7 @@ class TestE13CompactHangingE2E:
@pytest.mark.integration
@pytest.mark.skipif(not os.environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run real agent tests")
@skip_no_integration
class TestE14RollbackE2E:
"""E14: crash 后 current_agent 回退验证
+13
View File
@@ -2,6 +2,11 @@ import pytest
pytestmark = pytest.mark.e2e
skip_no_integration = pytest.mark.skipif(
not __import__("os").environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run E2E tests against real daemon",
)
"""v3.1 端到端测试 — 新增场景覆盖
覆盖 v3.1 新增功能:
@@ -169,6 +174,7 @@ def _patch_db_claimed_at(pid: str, tid: str, claimed_at: str):
@pytest.mark.integration
@pytest.mark.skipif(not os.environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run real agent tests")
@skip_no_integration
class TestE94BroadcastClaim:
"""E9-4: 无 assignee 任务 → 广播认领 → Agent 执行 → done"""
@@ -230,6 +236,7 @@ class TestE94BroadcastClaim:
@pytest.mark.integration
@pytest.mark.skipif(not os.environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run real agent tests")
@skip_no_integration
class TestE95PauseResume:
"""E9-5: 手动推状态到 working → paused → 恢复 → 验证 resumed_from"""
@@ -322,6 +329,7 @@ class TestE95PauseResume:
@pytest.mark.integration
@pytest.mark.skipif(not os.environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run real agent tests")
@skip_no_integration
class TestE96CancelledRestart:
"""E9-6: cancelled → pending(重新启动)→ Agent 执行 → done"""
@@ -388,6 +396,7 @@ class TestE96CancelledRestart:
@pytest.mark.integration
@pytest.mark.skipif(not os.environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run real agent tests")
@skip_no_integration
class TestE97ClaimedTimeout:
"""E9-7: claimed 超时 → pending (assignee 清空)"""
@@ -453,6 +462,7 @@ class TestE97ClaimedTimeout:
@pytest.mark.integration
@pytest.mark.skipif(not os.environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run real agent tests")
@skip_no_integration
class TestE98CacheHeaders:
"""E9-8: 验证 CachedStaticFiles 缓存头"""
@@ -524,6 +534,7 @@ class TestE98CacheHeaders:
@pytest.mark.integration
@pytest.mark.skipif(not os.environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run real agent tests")
@skip_no_integration
class TestE10cRetryChain:
"""E10c: failed → pending(手动重试)→ 广播 → 认领 → done"""
@@ -598,6 +609,7 @@ class TestE10cRetryChain:
@pytest.mark.integration
@pytest.mark.skipif(not os.environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run real agent tests")
@skip_no_integration
class TestE10dFullLifecycle:
"""E10d: 无 assignee → 广播认领 → claimed → working → review → done
@@ -690,6 +702,7 @@ class TestE10dFullLifecycle:
@pytest.mark.integration
@pytest.mark.skipif(not os.environ.get("RUN_INTEGRATION"),
reason="Set RUN_INTEGRATION=1 to run real agent tests")
@skip_no_integration
class TestE15PromptV3Broadcast:
"""E15: Prompt v3.0 广播认领三级响应 E2E