mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-02-18 04:01:08 -05:00
As the cloud e2e tests evolved some common patters became apparent. This standardizes and consolidates the patterns into a common test runner that takes the table tests and runs them in parallel. Some tests also needed to be converted to utilize table tests.
How to run tests
To run them, use:
TFE_TOKEN=<token> TFE_HOSTNAME=<hostname> TF_ACC=1 go test ./internal/cloud/e2e/... -ldflags "-X \"github.com/hashicorp/terraform/version.Prerelease=<PRE-RELEASE>\""
Required flags
TF_ACC=1. This variable is used as part of terraform for tests that make external network calls. This is needed to run these tests. Without it, the tests do not run.TFE_TOKEN=<admin token>andTFE_HOSTNAME=<hostname>. The helpers for these tests require admin access to a TFC/TFE instance.-timeout=30m. Some of these tests take longer than the default 10m timeout forgo test.
Flags
- Use the
-vflag for normal verbose mode. - Use the
-tfoutputflag to print the terraform output to standard out. - Use
-ldflagsto change the version Prerelease to match a version available remotely. Some behaviors rely on the exact local version Terraform being available in TFC/TFE, and manipulating the Prerelease during build is often the only way to ensure this. (More on-ldflags.)