2021-11-03 15:47:14 -05:00
# How to run tests
To run them, use:
```
2023-09-20 06:35:35 -05:00
TFE_TOKEN=< token > TFE_HOSTNAME=< hostname > TF_ACC=1 go test ./internal/cloud/e2e/... -ldflags "-X \"github.com/opentofu/opentofu/version.Prerelease=< PRE-RELEASE > \""
2021-11-03 15:47:14 -05:00
```
Required flags
2023-08-22 07:28:30 -05:00
* `TF_ACC=1` . This variable is used as part of opentf for tests that make
2021-11-03 15:47:14 -05:00
external network calls. This is needed to run these tests. Without it, the
tests do not run.
* `TFE_TOKEN=<admin token>` and `TFE_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 for `go test` .
### Flags
* Use the `-v` flag for normal verbose mode.
2023-08-22 07:28:30 -05:00
* Use the `-tfoutput` flag to print the opentf output to standard out.
2021-11-03 15:47:14 -05:00
* Use `-ldflags` to change the version Prerelease to match a version
2023-08-22 08:04:05 -05:00
available remotely. Some behaviors rely on the exact local version OpenTF
2021-11-03 15:47:14 -05:00
being available in TFC/TFE, and manipulating the Prerelease during build is
often the only way to ensure this.
[(More on `-ldflags`.) ](https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications )