terratest

gruntwork-io / terratest

Terratest 是一个 Go 库,用于简化基础设施代码的自动化测试,支持测试 Terraform、Kubernetes、Docker 等云原生资源。

Go 基础设施 开发工具 基础设施测试 Go库 自动化测试 IaC 测试框架

为什么值得看

编辑点评

基础设施代码也需要可靠的测试保障。Terratest 提供了一套实用的断言和工具函数,让开发者能用 Go 编写端到端测试,验证云资源是否按预期创建和运行。适合有 Go 基础、希望构建 IaC 测试回归体系的团队。注意测试真实环境会消耗云资源,建议结合短期环境或 Mock 策略使用。

Star 趋势

近 7 日
  • Star 总数7,942
  • 今日新增+-1
  • 7 日增速0%
  • Fork1,371

同类项目

同场景 · 基础设施 / 开发工具

项目文档

来自 GitHub README · main 分支

Terratest

Terratest is a Go library that makes it easier to write automated tests for your infrastructure code. It provides a variety of helper functions and patterns for common infrastructure testing tasks, including:

  • Testing Terraform code
  • Testing Packer templates
  • Testing Docker images
  • Executing commands on servers over SSH
  • Working with AWS APIs
  • Working with Azure APIs
  • Working with GCP APIs
  • Working with Kubernetes APIs
  • Testing Helm Charts
  • Making HTTP requests
  • Running shell commands
  • And much more

Install

go get github.com/gruntwork-io/terratest@latest

Requires Go 1.26 or later. To lock to a specific release instead of @latest, see Pinning a Terratest version.

Stability and versioning

Starting with v1.0.0, Terratest follows semantic versioning. Breaking changes to the public API only happen in major releases (e.g. v2.0.0).

Symbols renamed or replaced in v1 are kept with // Deprecated: annotations pointing at the new name; removals happen in v2. Migrating from v0.x: see the v1 migration guide. Migrating from v1 to v2: see the v2 migration guide.

v1 maintenance. With v2 in development, the v1 line has entered maintenance: it receives security fixes only, delivered on the v1 branch, until 12 months after v2.0.0 reaches general availability. v2 ships under new /v2 module paths, so pinned v1 consumers are unaffected. Upgrade on your own schedule.

More info

License

This code is released under the Apache 2.0 License. Please see LICENSE and NOTICE for more details.

Copyright © 2025 Gruntwork, Inc.

文档抓取自 GitHub 仓库 README,版权归原作者所有;已过滤徽章等噪音并经安全消毒后展示。