Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialize AppSync acceptance tests #21400

Merged
merged 6 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions internal/service/appsync/api_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import (
tfappsync "github.com/hashicorp/terraform-provider-aws/internal/service/appsync"
)

func TestAccAppSyncAPIKey_basic(t *testing.T) {
func testAccAppSyncAPIKey_basic(t *testing.T) {
var apiKey appsync.ApiKey
dateAfterSevenDays := time.Now().UTC().Add(time.Hour * 24 * time.Duration(7)).Truncate(time.Hour)
resourceName := "aws_appsync_api_key.test"
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand All @@ -47,12 +47,12 @@ func TestAccAppSyncAPIKey_basic(t *testing.T) {
})
}

func TestAccAppSyncAPIKey_description(t *testing.T) {
func testAccAppSyncAPIKey_description(t *testing.T) {
var apiKey appsync.ApiKey
resourceName := "aws_appsync_api_key.test"
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand Down Expand Up @@ -81,14 +81,14 @@ func TestAccAppSyncAPIKey_description(t *testing.T) {
})
}

func TestAccAppSyncAPIKey_expires(t *testing.T) {
func testAccAppSyncAPIKey_expires(t *testing.T) {
var apiKey appsync.ApiKey
dateAfterTenDays := time.Now().UTC().Add(time.Hour * 24 * time.Duration(10)).Truncate(time.Hour)
dateAfterTwentyDays := time.Now().UTC().Add(time.Hour * 24 * time.Duration(20)).Truncate(time.Hour)
resourceName := "aws_appsync_api_key.test"
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand Down
85 changes: 85 additions & 0 deletions internal/service/appsync/appsync_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package appsync_test

import (
"testing"
)

func TestAccAppSync_serial(t *testing.T) {
testCases := map[string]map[string]func(t *testing.T){
"APIKey": {
"basic": testAccAppSyncAPIKey_basic,
"description": testAccAppSyncAPIKey_description,
"expires": testAccAppSyncAPIKey_expires,
},
"DataSource": {
"basic": testAccAppSyncDataSource_basic,
"description": testAccAppSyncDataSource_description,
"DynamoDB_region": testAccAppSyncDataSource_DynamoDB_region,
"DynamoDB_useCallerCredentials": testAccAppSyncDataSource_DynamoDB_useCallerCredentials,
"ElasticSearch_region": testAccAppSyncDataSource_ElasticSearch_region,
"HTTP_endpoint": testAccAppSyncDataSource_HTTP_endpoint,
"type": testAccAppSyncDataSource_type,
"Type_dynamoDB": testAccAppSyncDataSource_Type_dynamoDB,
"Type_elasticSearch": testAccAppSyncDataSource_Type_elasticSearch,
"Type_http": testAccAppSyncDataSource_Type_http,
"Type_lambda": testAccAppSyncDataSource_Type_lambda,
"Type_none": testAccAppSyncDataSource_Type_none,
},
"GraphQLAPI": {
"basic": testAccAppSyncGraphQLAPI_basic,
"disappears": testAccAppSyncGraphQLAPI_disappears,
"schema": testAccAppSyncGraphQLAPI_schema,
"authenticationType": testAccAppSyncGraphQLAPI_authenticationType,
"AuthenticationType_apiKey": testAccAppSyncGraphQLAPI_AuthenticationType_apiKey,
"AuthenticationType_awsIAM": testAccAppSyncGraphQLAPI_AuthenticationType_awsIAM,
"AuthenticationType_amazonCognitoUserPools": testAccAppSyncGraphQLAPI_AuthenticationType_amazonCognitoUserPools,
"AuthenticationType_openIDConnect": testAccAppSyncGraphQLAPI_AuthenticationType_openIDConnect,
"log": testAccAppSyncGraphQLAPI_log,
"Log_fieldLogLevel": testAccAppSyncGraphQLAPI_Log_fieldLogLevel,
"Log_excludeVerboseContent": testAccAppSyncGraphQLAPI_Log_excludeVerboseContent,
"OpenIDConnect_authTTL": testAccAppSyncGraphQLAPI_OpenIDConnect_authTTL,
"OpenIDConnect_clientID": testAccAppSyncGraphQLAPI_OpenIDConnect_clientID,
"OpenIDConnect_iatTTL": testAccAppSyncGraphQLAPI_OpenIDConnect_iatTTL,
"OpenIDConnect_issuer": testAccAppSyncGraphQLAPI_OpenIDConnect_issuer,
"name": testAccAppSyncGraphQLAPI_name,
"UserPool_awsRegion": testAccAppSyncGraphQLAPI_UserPool_awsRegion,
"UserPool_defaultAction": testAccAppSyncGraphQLAPI_UserPool_defaultAction,
"tags": testAccAppSyncGraphQLAPI_tags,
"AdditionalAuthentication_apiKey": testAccAppSyncGraphQLAPI_AdditionalAuthentication_apiKey,
"AdditionalAuthentication_awsIAM": testAccAppSyncGraphQLAPI_AdditionalAuthentication_awsIAM,
"AdditionalAuthentication_cognitoUserPools": testAccAppSyncGraphQLAPI_AdditionalAuthentication_cognitoUserPools,
"AdditionalAuthentication_openIDConnect": testAccAppSyncGraphQLAPI_AdditionalAuthentication_openIDConnect,
"AdditionalAuthentication_multiple": testAccAppSyncGraphQLAPI_AdditionalAuthentication_multiple,
"xrayEnabled": testAccAppSyncGraphQLAPI_xrayEnabled,
},
"Function": {
"basic": testAccAppSyncFunction_basic,
"disappears": testAccAppSyncFunction_disappears,
"description": testAccAppSyncFunction_description,
"responseMappingTemplate": testAccAppSyncFunction_responseMappingTemplate,
},
"Resolver": {
"basic": testAccAppSyncResolver_basic,
"disappears": testAccAppSyncResolver_disappears,
"dataSource": testAccAppSyncResolver_dataSource,
"DataSource_lambda": testAccAppSyncResolver_DataSource_lambda,
"requestTemplate": testAccAppSyncResolver_requestTemplate,
"responseTemplate": testAccAppSyncResolver_responseTemplate,
"multipleResolvers": testAccAppSyncResolver_multipleResolvers,
"pipeline": testAccAppSyncResolver_pipeline,
"caching": testAccAppSyncResolver_caching,
},
}

for group, m := range testCases {
m := m
t.Run(group, func(t *testing.T) {
for name, tc := range m {
tc := tc
t.Run(name, func(t *testing.T) {
tc(t)
})
}
})
}
}
48 changes: 24 additions & 24 deletions internal/service/appsync/datasource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import (
tfappsync "github.com/hashicorp/terraform-provider-aws/internal/service/appsync"
)

func TestAccAppSyncDataSource_basic(t *testing.T) {
func testAccAppSyncDataSource_basic(t *testing.T) {
rName := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
resourceName := "aws_appsync_datasource.test"

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand Down Expand Up @@ -49,11 +49,11 @@ func TestAccAppSyncDataSource_basic(t *testing.T) {
})
}

func TestAccAppSyncDataSource_description(t *testing.T) {
func testAccAppSyncDataSource_description(t *testing.T) {
rName := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
resourceName := "aws_appsync_datasource.test"

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand Down Expand Up @@ -82,11 +82,11 @@ func TestAccAppSyncDataSource_description(t *testing.T) {
})
}

func TestAccAppSyncDataSource_DynamoDB_region(t *testing.T) {
func testAccAppSyncDataSource_DynamoDB_region(t *testing.T) {
rName := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
resourceName := "aws_appsync_datasource.test"

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand Down Expand Up @@ -117,11 +117,11 @@ func TestAccAppSyncDataSource_DynamoDB_region(t *testing.T) {
})
}

func TestAccAppSyncDataSource_DynamoDB_useCallerCredentials(t *testing.T) {
func testAccAppSyncDataSource_DynamoDB_useCallerCredentials(t *testing.T) {
rName := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
resourceName := "aws_appsync_datasource.test"

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand Down Expand Up @@ -152,11 +152,11 @@ func TestAccAppSyncDataSource_DynamoDB_useCallerCredentials(t *testing.T) {
})
}

func TestAccAppSyncDataSource_ElasticSearch_region(t *testing.T) {
func testAccAppSyncDataSource_ElasticSearch_region(t *testing.T) {
rName := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
resourceName := "aws_appsync_datasource.test"

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand Down Expand Up @@ -187,11 +187,11 @@ func TestAccAppSyncDataSource_ElasticSearch_region(t *testing.T) {
})
}

func TestAccAppSyncDataSource_HTTP_endpoint(t *testing.T) {
func testAccAppSyncDataSource_HTTP_endpoint(t *testing.T) {
rName := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
resourceName := "aws_appsync_datasource.test"

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand Down Expand Up @@ -224,11 +224,11 @@ func TestAccAppSyncDataSource_HTTP_endpoint(t *testing.T) {
})
}

func TestAccAppSyncDataSource_type(t *testing.T) {
func testAccAppSyncDataSource_type(t *testing.T) {
rName := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
resourceName := "aws_appsync_datasource.test"

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand All @@ -252,13 +252,13 @@ func TestAccAppSyncDataSource_type(t *testing.T) {
})
}

func TestAccAppSyncDataSource_Type_dynamoDB(t *testing.T) {
func testAccAppSyncDataSource_Type_dynamoDB(t *testing.T) {
rName := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
dynamodbTableResourceName := "aws_dynamodb_table.test"
iamRoleResourceName := "aws_iam_role.test"
resourceName := "aws_appsync_datasource.test"

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand All @@ -284,12 +284,12 @@ func TestAccAppSyncDataSource_Type_dynamoDB(t *testing.T) {
})
}

func TestAccAppSyncDataSource_Type_elasticSearch(t *testing.T) {
func testAccAppSyncDataSource_Type_elasticSearch(t *testing.T) {
rName := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
iamRoleResourceName := "aws_iam_role.test"
resourceName := "aws_appsync_datasource.test"

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand All @@ -315,11 +315,11 @@ func TestAccAppSyncDataSource_Type_elasticSearch(t *testing.T) {
})
}

func TestAccAppSyncDataSource_Type_http(t *testing.T) {
func testAccAppSyncDataSource_Type_http(t *testing.T) {
rName := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
resourceName := "aws_appsync_datasource.test"

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand All @@ -343,13 +343,13 @@ func TestAccAppSyncDataSource_Type_http(t *testing.T) {
})
}

func TestAccAppSyncDataSource_Type_lambda(t *testing.T) {
func testAccAppSyncDataSource_Type_lambda(t *testing.T) {
rName := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
iamRoleResourceName := "aws_iam_role.test"
lambdaFunctionResourceName := "aws_lambda_function.test"
resourceName := "aws_appsync_datasource.test"

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand All @@ -374,11 +374,11 @@ func TestAccAppSyncDataSource_Type_lambda(t *testing.T) {
})
}

func TestAccAppSyncDataSource_Type_none(t *testing.T) {
func testAccAppSyncDataSource_Type_none(t *testing.T) {
rName := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
resourceName := "aws_appsync_datasource.test"

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand Down
16 changes: 8 additions & 8 deletions internal/service/appsync/function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import (
tfappsync "github.com/hashicorp/terraform-provider-aws/internal/service/appsync"
)

func TestAccAppSyncFunction_basic(t *testing.T) {
func testAccAppSyncFunction_basic(t *testing.T) {
rName1 := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
rName2 := fmt.Sprintf("tfexample%s", sdkacctest.RandString(8))
rName3 := fmt.Sprintf("tfexample%s", sdkacctest.RandString(8))
resourceName := "aws_appsync_function.test"
var config appsync.FunctionConfiguration

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand Down Expand Up @@ -56,13 +56,13 @@ func TestAccAppSyncFunction_basic(t *testing.T) {
})
}

func TestAccAppSyncFunction_description(t *testing.T) {
func testAccAppSyncFunction_description(t *testing.T) {
rName1 := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
rName2 := fmt.Sprintf("tfexample%s", sdkacctest.RandString(8))
resourceName := "aws_appsync_function.test"
var config appsync.FunctionConfiguration

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand Down Expand Up @@ -91,13 +91,13 @@ func TestAccAppSyncFunction_description(t *testing.T) {
})
}

func TestAccAppSyncFunction_responseMappingTemplate(t *testing.T) {
func testAccAppSyncFunction_responseMappingTemplate(t *testing.T) {
rName1 := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
rName2 := fmt.Sprintf("tfexample%s", sdkacctest.RandString(8))
resourceName := "aws_appsync_function.test"
var config appsync.FunctionConfiguration

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand All @@ -118,13 +118,13 @@ func TestAccAppSyncFunction_responseMappingTemplate(t *testing.T) {
})
}

func TestAccAppSyncFunction_disappears(t *testing.T) {
func testAccAppSyncFunction_disappears(t *testing.T) {
rName1 := fmt.Sprintf("tfacctest%d", sdkacctest.RandInt())
rName2 := fmt.Sprintf("tfexample%s", sdkacctest.RandString(8))
resourceName := "aws_appsync_function.test"
var config appsync.FunctionConfiguration

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckPartitionHasService(appsync.EndpointsID, t) },
ErrorCheck: acctest.ErrorCheck(t, appsync.EndpointsID),
Providers: acctest.Providers,
Expand Down
Loading