Skip to content

Commit

Permalink
Merge pull request #18223 from hashicorp/t-redshift-errorcheck
Browse files Browse the repository at this point in the history
tests/redshift:Add ErrorCheck
  • Loading branch information
YakDriver authored Mar 19, 2021
2 parents 14bef4b + b839427 commit 494ed41
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 6 deletions.
16 changes: 10 additions & 6 deletions aws/data_source_aws_redshift_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ import (
"fmt"
"testing"

"github.com/aws/aws-sdk-go/service/redshift"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccAWSDataSourceRedshiftCluster_basic(t *testing.T) {
rInt := acctest.RandInt()
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccAWSDataSourceRedshiftClusterConfig(rInt),
Expand Down Expand Up @@ -44,8 +46,9 @@ func TestAccAWSDataSourceRedshiftCluster_basic(t *testing.T) {
func TestAccAWSDataSourceRedshiftCluster_vpc(t *testing.T) {
rInt := acctest.RandInt()
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccAWSDataSourceRedshiftClusterConfigWithVpc(rInt),
Expand All @@ -63,8 +66,9 @@ func TestAccAWSDataSourceRedshiftCluster_vpc(t *testing.T) {
func TestAccAWSDataSourceRedshiftCluster_logging(t *testing.T) {
rInt := acctest.RandInt()
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccAWSDataSourceRedshiftClusterConfigWithLogging(rInt),
Expand Down
4 changes: 4 additions & 0 deletions aws/data_source_aws_redshift_orderable_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ func TestAccAWSRedshiftOrderableClusterDataSource_ClusterType(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccAWSRedshiftOrderableClusterPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: nil,
Steps: []resource.TestStep{
Expand All @@ -32,6 +33,7 @@ func TestAccAWSRedshiftOrderableClusterDataSource_ClusterVersion(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccAWSRedshiftOrderableClusterPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: nil,
Steps: []resource.TestStep{
Expand All @@ -51,6 +53,7 @@ func TestAccAWSRedshiftOrderableClusterDataSource_NodeType(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccAWSRedshiftOrderableClusterPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: nil,
Steps: []resource.TestStep{
Expand All @@ -70,6 +73,7 @@ func TestAccAWSRedshiftOrderableClusterDataSource_PreferredNodeTypes(t *testing.

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccAWSRedshiftOrderableClusterPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: nil,
Steps: []resource.TestStep{
Expand Down
15 changes: 15 additions & 0 deletions aws/resource_aws_redshift_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func TestAccAWSRedshiftCluster_basic(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftClusterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -103,6 +104,7 @@ func TestAccAWSRedshiftCluster_withFinalSnapshot(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftClusterSnapshot(rInt),
Steps: []resource.TestStep{
Expand Down Expand Up @@ -136,6 +138,7 @@ func TestAccAWSRedshiftCluster_kmsKey(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftClusterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -171,6 +174,7 @@ func TestAccAWSRedshiftCluster_enhancedVpcRoutingEnabled(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftClusterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -210,6 +214,7 @@ func TestAccAWSRedshiftCluster_loggingEnabled(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftClusterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -255,6 +260,7 @@ func TestAccAWSRedshiftCluster_snapshotCopy(t *testing.T) {
testAccPreCheck(t)
testAccMultipleRegionPreCheck(t, 2)
},
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
ProviderFactories: testAccProviderFactoriesAlternate(&providers),
CheckDestroy: testAccCheckAWSRedshiftClusterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -289,6 +295,7 @@ func TestAccAWSRedshiftCluster_iamRoles(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftClusterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -319,6 +326,7 @@ func TestAccAWSRedshiftCluster_publiclyAccessible(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftClusterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -352,6 +360,7 @@ func TestAccAWSRedshiftCluster_updateNodeCount(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftClusterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -389,6 +398,7 @@ func TestAccAWSRedshiftCluster_updateNodeType(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftClusterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -426,6 +436,7 @@ func TestAccAWSRedshiftCluster_tags(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftClusterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -461,6 +472,7 @@ func TestAccAWSRedshiftCluster_forceNewUsername(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftClusterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -494,6 +506,7 @@ func TestAccAWSRedshiftCluster_changeAvailabilityZone(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftClusterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -525,6 +538,7 @@ func TestAccAWSRedshiftCluster_changeEncryption1(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftClusterDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -557,6 +571,7 @@ func TestAccAWSRedshiftCluster_changeEncryption2(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftClusterDestroy,
Steps: []resource.TestStep{
Expand Down
5 changes: 5 additions & 0 deletions aws/resource_aws_redshift_event_subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func TestAccAWSRedshiftEventSubscription_basicUpdate(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftEventSubscriptionDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -111,6 +112,7 @@ func TestAccAWSRedshiftEventSubscription_withPrefix(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftEventSubscriptionDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -144,6 +146,7 @@ func TestAccAWSRedshiftEventSubscription_withSourceIds(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftEventSubscriptionDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -191,6 +194,7 @@ func TestAccAWSRedshiftEventSubscription_categoryUpdate(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftEventSubscriptionDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -232,6 +236,7 @@ func TestAccAWSRedshiftEventSubscription_tagsUpdate(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftEventSubscriptionDestroy,
Steps: []resource.TestStep{
Expand Down
4 changes: 4 additions & 0 deletions aws/resource_aws_redshift_parameter_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func TestAccAWSRedshiftParameterGroup_basic(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftParameterGroupDestroy,
Steps: []resource.TestStep{
Expand All @@ -44,6 +45,7 @@ func TestAccAWSRedshiftParameterGroup_withParameters(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftParameterGroupDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -87,6 +89,7 @@ func TestAccAWSRedshiftParameterGroup_withoutParameters(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftParameterGroupDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -118,6 +121,7 @@ func TestAccAWSRedshiftParameterGroup_withTags(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftParameterGroupDestroy,
Steps: []resource.TestStep{
Expand Down
5 changes: 5 additions & 0 deletions aws/resource_aws_redshift_security_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func TestAccAWSRedshiftSecurityGroup_basic(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
ProviderFactories: testAccProviderFactories,
CheckDestroy: testAccCheckAWSRedshiftSecurityGroupDestroy,
Steps: []resource.TestStep{
Expand All @@ -44,6 +45,7 @@ func TestAccAWSRedshiftSecurityGroup_ingressCidr(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
ProviderFactories: testAccProviderFactories,
CheckDestroy: testAccCheckAWSRedshiftSecurityGroupDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -78,6 +80,7 @@ func TestAccAWSRedshiftSecurityGroup_updateIngressCidr(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
ProviderFactories: testAccProviderFactories,
CheckDestroy: testAccCheckAWSRedshiftSecurityGroupDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -121,6 +124,7 @@ func TestAccAWSRedshiftSecurityGroup_ingressSecurityGroup(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
ProviderFactories: testAccProviderFactories,
CheckDestroy: testAccCheckAWSRedshiftSecurityGroupDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -152,6 +156,7 @@ func TestAccAWSRedshiftSecurityGroup_updateIngressSecurityGroup(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
ProviderFactories: testAccProviderFactories,
CheckDestroy: testAccCheckAWSRedshiftSecurityGroupDestroy,
Steps: []resource.TestStep{
Expand Down
3 changes: 3 additions & 0 deletions aws/resource_aws_redshift_snapshot_copy_grant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func TestAccAWSRedshiftSnapshotCopyGrant_basic(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftSnapshotCopyGrantDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -44,6 +45,7 @@ func TestAccAWSRedshiftSnapshotCopyGrant_Update(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftSnapshotCopyGrantDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -87,6 +89,7 @@ func TestAccAWSRedshiftSnapshotCopyGrant_disappears(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftSnapshotCopyGrantDestroy,
Steps: []resource.TestStep{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func TestAccAWSRedshiftSnapshotScheduleAssociation_basic(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftSnapshotScheduleAssociationDestroy,
Steps: []resource.TestStep{
Expand Down
6 changes: 6 additions & 0 deletions aws/resource_aws_redshift_snapshot_schedule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func TestAccAWSRedshiftSnapshotSchedule_basic(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftSnapshotScheduleDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -121,6 +122,7 @@ func TestAccAWSRedshiftSnapshotSchedule_withMultipleDefinition(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftSnapshotScheduleDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -158,6 +160,7 @@ func TestAccAWSRedshiftSnapshotSchedule_withIdentifierPrefix(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftSnapshotScheduleDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -188,6 +191,7 @@ func TestAccAWSRedshiftSnapshotSchedule_withDescription(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftSnapshotScheduleDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -219,6 +223,7 @@ func TestAccAWSRedshiftSnapshotSchedule_withTags(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftSnapshotScheduleDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -262,6 +267,7 @@ func TestAccAWSRedshiftSnapshotSchedule_withForceDestroy(t *testing.T) {

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID),
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSRedshiftSnapshotScheduleDestroy,
Steps: []resource.TestStep{
Expand Down
Loading

0 comments on commit 494ed41

Please sign in to comment.