@@ -12,13 +12,14 @@ import (
1212 "regexp"
1313 "strings"
1414 "syscall"
15- "testing"
15+ gotesting "testing"
1616
1717 "github.com/hashicorp/go-multierror"
1818 "github.com/hashicorp/logutils"
1919
2020 "github.com/hashicorp/terraform-plugin-sdk/v2/acctest"
2121 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
22+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource/testing"
2223 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
2324 "github.com/hashicorp/terraform-plugin-sdk/v2/internal/addrs"
2425 "github.com/hashicorp/terraform-plugin-sdk/v2/internal/diagutils"
@@ -86,7 +87,7 @@ func AddTestSweepers(name string, s *Sweeper) {
8687 sweeperFuncs [name ] = s
8788}
8889
89- func TestMain (m * testing.M ) {
90+ func TestMain (m testing.M ) {
9091 flag .Parse ()
9192 if * flagSweep != "" {
9293 // parse flagSweep contents for regions to run
@@ -460,7 +461,7 @@ type TestStep struct {
460461// Set to a file mask in sprintf format where %s is test name
461462const envLogPathMask = "TF_LOG_PATH_MASK"
462463
463- func logOutput (t TestT ) (logOutput io.Writer , err error ) {
464+ func logOutput (t testing. T ) (logOutput io.Writer , err error ) {
464465 logOutput = ioutil .Discard
465466
466467 logLevel := logging .LogLevel ()
@@ -506,7 +507,7 @@ func logOutput(t TestT) (logOutput io.Writer, err error) {
506507// Tests will fail if they do not properly handle conditions to allow multiple
507508// tests to occur against the same resource or service (e.g. random naming).
508509// All other requirements of the Test function also apply to this function.
509- func ParallelTest (t TestT , c TestCase ) {
510+ func ParallelTest (t testing. T , c TestCase ) {
510511 t .Parallel ()
511512 Test (t , c )
512513}
@@ -521,7 +522,7 @@ func ParallelTest(t TestT, c TestCase) {
521522// the "-test.v" flag) is set. Because some acceptance tests take quite
522523// long, we require the verbose flag so users are able to see progress
523524// output.
524- func Test (t TestT , c TestCase ) {
525+ func Test (t testing. T , c TestCase ) {
525526 // We only run acceptance tests if an env var is set because they're
526527 // slow and generally require some outside configuration. You can opt out
527528 // of this with OverrideEnvVar on individual TestCases.
@@ -539,7 +540,7 @@ func Test(t TestT, c TestCase) {
539540 log .SetOutput (logWriter )
540541
541542 // We require verbose mode so that the user knows what is going on.
542- if ! testing .Verbose () && ! c .IsUnitTest {
543+ if ! gotesting .Verbose () && ! c .IsUnitTest {
543544 t .Fatal ("Acceptance tests must be run with the -v flag on tests" )
544545 }
545546
@@ -594,7 +595,7 @@ func testProviderConfig(c TestCase) string {
594595// UnitTest is a helper to force the acceptance testing harness to run in the
595596// normal unit test suite. This should only be used for resource that don't
596597// have any external dependencies.
597- func UnitTest (t TestT , c TestCase ) {
598+ func UnitTest (t testing. T , c TestCase ) {
598599 c .IsUnitTest = true
599600 Test (t , c )
600601}
@@ -980,22 +981,6 @@ func TestMatchOutput(name string, r *regexp.Regexp) TestCheckFunc {
980981 }
981982}
982983
983- // TestT is the interface used to handle the test lifecycle of a test.
984- //
985- // Users should just use a *testing.T object, which implements this.
986- type TestT interface {
987- Error (args ... interface {})
988- FailNow ()
989- Fatal (args ... interface {})
990- Fatalf (format string , args ... interface {})
991- Helper ()
992- Log (args ... interface {})
993- Name () string
994- Parallel ()
995- Skip (args ... interface {})
996- SkipNow ()
997- }
998-
999984// modulePrimaryInstanceState returns the instance state for the given resource
1000985// name in a ModuleState
1001986func modulePrimaryInstanceState (s * terraform.State , ms * terraform.ModuleState , name string ) (* terraform.InstanceState , error ) {
0 commit comments