mixed_sustained_acceptance.py 849 B

123456789101112131415161718192021222324
  1. import asyncio
  2. import json
  3. from pathlib import Path
  4. from mixed_capacity_acceptance import mixed_admission
  5. from test_after_sales import scenario # noqa: F401
  6. async def test_sustained_tenant_reservation_with_knowledge(scenario): # noqa: F811
  7. # 32轮各等待1秒,验证持续竞争;生成调用为零,总执行期限由共用测试限制为60秒。
  8. await mixed_admission(
  9. scenario,
  10. rounds=32,
  11. b_requests=32,
  12. knowledge_queries=32,
  13. pause=1,
  14. report_path=".work/mixed-sustained.json",
  15. )
  16. report = json.loads(
  17. await asyncio.to_thread(Path(".work/mixed-sustained.json").read_text, encoding="utf-8")
  18. )
  19. assert 32 <= report["load_seconds"] < 60
  20. assert report["a_statuses"] == {"429": 256}
  21. assert report["b_accepted"] == 32 and report["generation_attempts"] == 0