pulumi/docs/architecture/testing/integration.md

1.2 KiB

(integration-testing)=

Integration tests

Integration tests use the built binaries for the CLI and language runtimes. We have some helpers that allow us to create test scenarios and invoke CLI commands.

  • ProgramTest: this is typically the easiest way to write an integration test. ProgramTest imports a Pulumi program from the testdata directory, and runs a series of CLI commands against it.
  • Environment: this is lower level than ProgramTest. It takes care of creating a temporary directory to run commands in via Environment.RunCommand. Use Environment.ImportDirectory to import a test scenario into the environment.

How and when to use

:::{attention} Before running integration tests, make sure to rebuild the binaries your test will use.

# from the repostiory root, build and install `pulumi`
make build install
# from sdk/{python,nodejs,go}, build and install the required language runtimes
cd sdk/python
make build install

:::

To run a single integration test, run the following command from the repository root.

go test -tags=all github.com/pulumi/pulumi/tests/integration -run ${MY_TEST_TO_RUN}