"""Load test benchmark validating sustained throughput for 100 articles/hour.""" import time from pathlib import Path from src.runtime.candidate.parser import build_candidates_payload from src.runtime.hygiene.harness import execute_deterministic_hygiene_fallback def test_sustained_throughput_benchmark(): # Simulate processing 20 articles in batch ref_files = list(Path("evals/reference_20").glob("article_*.json")) assert len(ref_files) == 20 start_time = time.time() for f in ref_files: import json data = json.loads(f.read_text(encoding="utf-8")) payload = build_candidates_payload(data) md, meta = execute_deterministic_hygiene_fallback(payload) assert len(md) > 0 elapsed = time.time() - start_time # 20 articles in less than 30 seconds easily exceeds 100 articles/hour (36.0s per article = 720s for 20 articles) assert elapsed < 30.0, f"Processing took {elapsed}s, exceeded staging throughput SLA"