Skip to content

Commit d76cf67

Browse files
authored
Merge pull request #385 from hashicorp/paultyng-patch-1
Add package docs for binary test driver
2 parents e1ddbee + 062e33f commit d76cf67

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

acctest/doc.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package acctest
2+
3+
// Package acctest provides the ability to opt in to the new binary test driver. The binary
4+
// test driver allows you to run your acceptance tests with a binary of Terraform instead of
5+
// an emulated version packaged inside the SDK. This allows for a number of important
6+
// enhancements, but most notably a more realistic testing experience and matrix testing
7+
// against multiple versions of Terraform CLI. This also allows the SDK to be completely
8+
// separated, at a dependency level, from the Terraform CLI, as long as it is >= 0.12.0
9+
//
10+
// The new test driver must be enabled by initialising the test helper in your TestMain
11+
// function in all provider packages that run acceptance tests. Most providers have only
12+
// one package.
13+
//
14+
// In v2 of the SDK, the binary test driver will be mandatory.
15+
//
16+
// After importing this package, you can add code similar to the following:
17+
//
18+
// func TestMain(m *testing.M) {
19+
// acctest.UseBinaryDriver("provider_name", Provider)
20+
// resource.TestMain(m)
21+
// }
22+
// Where `Provider` is the function that returns the instance of a configured `terraform.ResourceProvider`
23+
// Some providers already have a TestMain defined, usually for the purpose of enabling test
24+
// sweepers. These additional occurrences should be removed.
25+
//
26+
// Initialising the binary test helper using UseBinaryDriver causes all tests to be run using
27+
// the new binary driver. Until SDK v2, the DisableBinaryDriver boolean property can be used
28+
// to use the legacy test driver for an individual TestCase.
29+
//
30+
// It is no longer necessary to import other Terraform providers as Go modules: these
31+
// imports should be removed.

0 commit comments

Comments
 (0)