一句话:提出 EMIaC,用 e-graph 生成等价 IaC 程序并检查蜕变关系,以测试 Terraform、Pulumi 等 IaC 引擎。
针对 IaC 引擎可靠性测试不足的问题,现有测试依赖手工预言且难以暴露跨多次执行的故障。EMIaC 将蜕变关系定义为 IaC 程序的图变换,通过在原始与变换程序执行间检查不变量来测试引擎。其核心创新在于把 e-graph 同时用作测试输入生成器和等价预言:e-graph 紧凑表示程序等价性,可系统生成大量等价 IaC 程序;对 43,593 个真实 Terraform 程序的分析表明依赖图通常小而稀疏,适合 e-graph。在 Pulumi、Terraform 和 OpenTofu 上评估,EMIaC 覆盖了 Terraform 的 98 条、Pulumi 的 1,313 条此前未测试语句,发现三个测试套件中未知问题,并有测试用例被合并。
Infrastructure-as-Code (IaC) engines, such as Terraform, OpenTofu, and Pulumi, automate the provisioning and management of cloud resources. They parse IaC specifications and orchestrate the required actions, making them the backbone of modern clouds, and critical to the reliability of both the underlying infrastructure and the software that depends on it. Despite this importance, this class of systems has received little attention: prior work largely targets the correctness of IaC programs rather than the IaC engines themselves. Existing test suites rely on manually written oracles and struggle to expose faults that manifest across multiple executions, leaving a significant reliability gap. We present EMI a C, a metamorphic testing framework for IaC engines. EMI a C defines metamorphic relations as graph-based transformations of IaC programs and checks invariants across executions of the original and transformed programs. A central novelty is our use of e-graphs in software testing, as both a test-input generator and an equivalence oracle. E-graphs compactly represent program equivalences, enabling the systematic generation of large spaces of equivalent IaC programs. To ground these relations, we analyze 43,593 real-world Terraform programs and show that IaC dependency graphs are typically small and sparse, making e-graphs a natural fit. Evaluating EMI a C on Pulumi, Terraform, and OpenTofu, we show that it complements existing test suites by exercising engine-critical code paths and covering 98 previously untested statements in Terraform and 1,313 in Pulumi. EMI a C also uncovers previously unknown issues in all three test suites, improving their adequacy. Three test cases have been merged into Terraform’s main branch, and Pulumi has merged a specification fix.
@article{paperbot3784,
title = {Metamorphic Testing for Infrastructure-as-Code Engines},
author = {David Spielmann and George Zakhour and Dominik Arnold and Matteo Biagiola and Roland Meier and Guido Salvaneschi},
journal = {Proceedings of the ACM on Programming Languages},
volume = {10},
number = {OOPSLA1},
year = {2026},
doi = {10.1145/3798226}
}