An acceptance test is a Go test function with the prefix TestAcc.
To run a focused acceptance test named TestAccFeatureHappyPath:
- Run
go test -run=TestAccFeatureHappyPathwithTF_ACC=1. Default to non-verbose output. - Some providers require additional environment variables. If the test output reports missing variables, suggest secure setup steps.
To diagnose a failing test, apply these options cumulatively (each includes the previous):
- Re-run with
-count=1to bypass the Go test cache. - Add
-vfor verbose output. - Set
TF_LOG=debugfor debug-level logging. - Set
TF_ACC_WORKING_DIR_PERSIST=1to preserve the Terraform workspace for inspection.
A passing test may be a false negative. To "flip" a passing test:
- Edit a TestCheckFunc value in a TestStep of the TestCase.
- Run the test — expect failure.
- If it fails, undo the edit and report a successful flip. If it passes, keep the edit and report an unsuccessful flip.