This folder contains automated tests for this Module. All of the tests are written in Go. These are "integration tests" that deploy real infrastructure using Terraform and verify that infrastructure works as expected using a helper library called Terratest.
Note #1: These tests create real resources within the provider used, so your access credentials must be have permissions required for all operations.
Note #2: Never forcefully shut the tests down (e.g. by hitting CTRL + C
) or the cleanup tasks won't run!
Note #3: These tests often complete within about 1m, however Go has a default test timeout of 10 minutes, after which it forcefully kills the tests with a SIGQUIT
, preventing the cleanup tasks from running.
- Install the latest version of Go.
- Install Terraform.
- Create a
Personal Access Token
for communication with GitHub or GitHub Enterprise API with permissions to create/delete repositories, teams, users, etc. - Export this as an environment variable
GITHUB_TOKEN
- Export
GITHUB_OWNER
orGITHUB_REPOSITORY_OWNER
as the GitHub Organization (your user, or your organization)
cd test/terratest
go test -v -timeout 2m
To run a specific test called TestTerraformSingleExample
:
cd test
go test -v -timeout 2m -run TestTerraformSingleExample