MIRAGE:微服务依赖测试的在线LLM模拟
MIRAGE: Online LLM Simulation for Microservice Dependency Testing
AI总结:
MIRAGE通过在线LLM模拟动态响应微服务依赖请求,提升测试场景的覆盖率和准确性,尤其在错误处理和代码推理方面表现更优。
摘要:
现有微服务依赖模拟方法(记录回放、模式挖掘和规范驱动的桩)在测试执行前生成静态工件,只能复现生成时编码的行为;在错误处理和代码推理场景中,记录回放在评估中仅达到0%和12%的保真度。我们提出了在线LLM模拟,一种在运行时处理依赖请求的方法,LLM在请求到来时回答,保持跨请求状态。模型读取依赖源代码、调用方代码和生产轨迹,按需模拟行为,以覆盖静态工件遗漏的场景,尽管这会带来约3秒每请求的延迟和每依赖0.16-0.82美元的成本。我们将在MIRAGE中实现该方法,并在三个微服务系统(Google的Online Boutique、Weaveworks的Sock Shop和一个自定义系统)上评估110个测试场景。在白盒模式下,MIRAGE在状态码和响应形状保真度上达到99%,相比记录回放的62%/16%。信号消融显示依赖源代码通常足够(单独100%);没有它,模型保留错误码准确性(94%)但失去响应结构保真度(75%)。结果在三个LLM家族中稳定(差异在3%以内),并在重复运行中确定性。调用方集成测试与真实依赖产生相同的通过/失败结果(8/8场景)
英文摘要:
Existing approaches to microservice dependency simulation--record-replay, pattern-mining, and specification-driven stubs--generate static artifacts before test execution. These artifacts can only reproduce behaviors encoded at generation time; on error-handling and code-reasoning scenarios, which are underrepresented in typical trace corpora, record-replay achieves 0% and 12% fidelity in our evaluation. We propose online LLM simulation, a runtime approach where the LLM answers each dependency request as it arrives, maintaining cross-request state throughout a test scenario. The model reads the dependency's source code, caller code, and production traces, then simulates behavior on demand--trading latency (~3 s per request) and cost ($0.16-$0.82 per dependency) for coverage on scenarios that static artifacts miss. We instantiate this approach in MIRAGE and evaluate it on 110 test scenarios across three microservice systems (Google's Online Boutique, Weaveworks' Sock Shop, and a custom system). In white-box mode, MIRAGE achieves 99% status-code and 99% response-shape fidelity, compared to 62% / 16% for record-replay. A signal ablation shows dependency source code is often sufficient (100% alone); without it, the model retains error-code accuracy (94%) but loses response-structure fidelity (75%). Results are stable across three LLM families (within 3%) and deterministic across repeated runs. Caller integration tests produce the same pass/fail outcomes with MIRAGE as with real dependencies (8/8 scenarios).
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。