Skip to content

Commit

Permalink
internal/provider(test): remove DMS from unusual endpoint tests (#38694)
Browse files Browse the repository at this point in the history
DMS has been migrated to AWS SDK for Go V2, and thus the corresponding `DMSConn` method to create a V1 client no longer exists. The generic `TestAccProvider_endpoints` test effectively ignores services which use V2 AWS SDK clients with the following conditional in the test check function (`serviceConn` will always return a method name ending in `Conn`):

```go
			methodName := serviceConn(serviceKey)
			method := reflect.ValueOf(providerClient).MethodByName(methodName)
			if !method.IsValid() {
				continue
			}
```

Because this generic test check ignores V2 clients, the DMS case for the unusual endpoints tests has been removed entirely rather than including new conditional logic which would effectively just skip the case before executing any real checks.

```console
% TF_ACC=1 go test -count=1 ./internal/provider/... -run="TestAccProvider_unusualEndpoints"
?       github.com/hashicorp/terraform-provider-aws/internal/provider/fwprovider        [no test files]
ok      github.com/hashicorp/terraform-provider-aws/internal/provider   23.263s
```
  • Loading branch information
jar-b authored Aug 5, 2024
1 parent 2ecaa69 commit 78c1240
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions internal/provider/provider_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,7 @@ func TestAccProvider_unusualEndpoints(t *testing.T) {
ctx := acctest.Context(t)
var provider *schema.Provider
unusual1 := unusualEndpoint{"es", "elasticsearch", "http://notarealendpoint"}
unusual2 := unusualEndpoint{"databasemigration", "dms", "http://alsonotarealendpoint"}
unusual3 := unusualEndpoint{"lexmodelbuildingservice", "lexmodels", "http://kingofspain"}
unusual2 := unusualEndpoint{"lexmodelbuildingservice", "lexmodels", "http://kingofspain"}

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
Expand All @@ -227,11 +226,10 @@ func TestAccProvider_unusualEndpoints(t *testing.T) {
CheckDestroy: nil,
Steps: []resource.TestStep{
{
Config: testAccProviderConfig_unusualEndpoints(unusual1, unusual2, unusual3),
Config: testAccProviderConfig_unusualEndpoints(unusual1, unusual2),
Check: resource.ComposeTestCheckFunc(
testAccCheckUnusualEndpoints(ctx, &provider, unusual1),
testAccCheckUnusualEndpoints(ctx, &provider, unusual2),
testAccCheckUnusualEndpoints(ctx, &provider, unusual3),
),
},
},
Expand Down Expand Up @@ -1056,7 +1054,7 @@ resource "aws_s3_bucket" "test" {
`, endpoint, rName))
}

func testAccProviderConfig_unusualEndpoints(unusual1, unusual2, unusual3 unusualEndpoint) string {
func testAccProviderConfig_unusualEndpoints(unusual1, unusual2 unusualEndpoint) string {
//lintignore:AT004
return acctest.ConfigCompose(testAccProviderConfig_base, fmt.Sprintf(`
provider "aws" {
Expand All @@ -1067,10 +1065,9 @@ provider "aws" {
endpoints {
%[1]s = %[2]q
%[3]s = %[4]q
%[5]s = %[6]q
}
}
`, unusual1.fieldName, unusual1.url, unusual2.fieldName, unusual2.url, unusual3.fieldName, unusual3.url))
`, unusual1.fieldName, unusual1.url, unusual2.fieldName, unusual2.url))
}

func testAccProviderConfig_useFipsEndpointFlag(rName string) string {
Expand Down

0 comments on commit 78c1240

Please sign in to comment.