Testing infrastructure usually means deploying it to a sandbox, waiting 15 minutes, running a bash script to ping an IP, and tearing it down. Because Pulumi is TypeScript, we can use the industry-standard Jest testing framework to write offline, millisecond unit tests to validate our infrastructure logic before we ever touch the cloud.
Running ’terraform plan’ is not enough to guarantee your infrastructure works. In this final episode, we bridge the gap between DevOps and Software Engineering by writing automated Golang tests using Terratest. We will programmatically provision infrastructure, assert its correctness, and tear it down.
Go includes a first-class test runner built into the go test CLI. You don’t need external test frameworks like Jest or JUnit to write unit tests, benchmarks, or fuzzers.