Skip to main content

Search the Dev Center

Search tutorials, templates, examples, and more.

Unit testing Pulumi programs in Go

An example that applies unit testing to Go and AWS resources.

This example lives in the pulumi/examples repository. Check out just this directory to use it:

Get started with this example
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set testing-unit-go
cd pulumi-examples/testing-unit-go

An example of writing mock-based unit tests with both infrastructure definition and tests written in Go.

Running the tests#

Run the tests:

Terminal window
go test
PASS
ok testing-unit-go 0.400s

Learn more#

Learn more about testing Pulumi programs:

Related

The infrastructure as code platform for any cloud.