From 1b713e87b8ec756d6fb51e2b7c4a0d083e4e16ef Mon Sep 17 00:00:00 2001 From: Jake Champlin Date: Mon, 30 Jan 2017 16:28:24 -0500 Subject: [PATCH] provider/aws: Fix AWS RDS Cluster Parameter Group Tests Fixes `aws_rds_cluster_parameter_group` acceptance tests, which have been broken since aa8c2ac587e6214159dd16e692b54b83cf1d4ad2 ``` $ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSDBClusterParameterGroupOnly' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/30 16:20:38 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSDBClusterParameterGroupOnly -timeout 120m === RUN TestAccAWSDBClusterParameterGroupOnly --- PASS: TestAccAWSDBClusterParameterGroupOnly (15.26s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 15.282s ``` ``` $ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSDBClusterParameterGroup_basic' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/01/30 16:22:48 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSDBClusterParameterGroup_basic -timeout 120m === RUN TestAccAWSDBClusterParameterGroup_basic --- PASS: TestAccAWSDBClusterParameterGroup_basic (29.48s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 29.510s ``` --- ...esource_aws_rds_cluster_parameter_group_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/builtin/providers/aws/resource_aws_rds_cluster_parameter_group_test.go b/builtin/providers/aws/resource_aws_rds_cluster_parameter_group_test.go index d6bb77d8f..f2a526d2e 100644 --- a/builtin/providers/aws/resource_aws_rds_cluster_parameter_group_test.go +++ b/builtin/providers/aws/resource_aws_rds_cluster_parameter_group_test.go @@ -28,7 +28,7 @@ func TestAccAWSDBClusterParameterGroup_basic(t *testing.T) { Config: testAccAWSDBClusterParameterGroupConfig(parameterGroupName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSDBClusterParameterGroupExists("aws_rds_cluster_parameter_group.bar", &v), - testAccCheckAWSDBClusterParameterGroupAttributes(&v), + testAccCheckAWSDBClusterParameterGroupAttributes(&v, parameterGroupName), resource.TestCheckResourceAttr( "aws_rds_cluster_parameter_group.bar", "name", parameterGroupName), resource.TestCheckResourceAttr( @@ -55,7 +55,7 @@ func TestAccAWSDBClusterParameterGroup_basic(t *testing.T) { Config: testAccAWSDBClusterParameterGroupAddParametersConfig(parameterGroupName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSDBClusterParameterGroupExists("aws_rds_cluster_parameter_group.bar", &v), - testAccCheckAWSDBClusterParameterGroupAttributes(&v), + testAccCheckAWSDBClusterParameterGroupAttributes(&v, parameterGroupName), resource.TestCheckResourceAttr( "aws_rds_cluster_parameter_group.bar", "name", parameterGroupName), resource.TestCheckResourceAttr( @@ -126,7 +126,7 @@ func TestAccAWSDBClusterParameterGroupOnly(t *testing.T) { Config: testAccAWSDBClusterParameterGroupOnlyConfig(parameterGroupName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSDBClusterParameterGroupExists("aws_rds_cluster_parameter_group.bar", &v), - testAccCheckAWSDBClusterParameterGroupAttributes(&v), + testAccCheckAWSDBClusterParameterGroupAttributes(&v, parameterGroupName), resource.TestCheckResourceAttr( "aws_rds_cluster_parameter_group.bar", "name", parameterGroupName), resource.TestCheckResourceAttr( @@ -213,15 +213,15 @@ func testAccCheckAWSDBClusterParameterGroupDestroy(s *terraform.State) error { return nil } -func testAccCheckAWSDBClusterParameterGroupAttributes(v *rds.DBClusterParameterGroup) resource.TestCheckFunc { +func testAccCheckAWSDBClusterParameterGroupAttributes(v *rds.DBClusterParameterGroup, name string) resource.TestCheckFunc { return func(s *terraform.State) error { - if *v.DBClusterParameterGroupName != "cluster-parameter-group-test-terraform" { - return fmt.Errorf("bad name: %#v", v.DBClusterParameterGroupName) + if *v.DBClusterParameterGroupName != name { + return fmt.Errorf("bad name: %#v expected: %v", *v.DBClusterParameterGroupName, name) } if *v.DBParameterGroupFamily != "aurora5.6" { - return fmt.Errorf("bad family: %#v", v.DBParameterGroupFamily) + return fmt.Errorf("bad family: %#v", *v.DBParameterGroupFamily) } return nil