Skip to content

Commit

Permalink
Updates aws_rds_cluster acceptance tests to use ARN testing check fun…
Browse files Browse the repository at this point in the history
…ctions

Addresses:
aws/resource_aws_rds_cluster_test.go:117:6: AWSAT001: prefer resource.TestCheckResourceAttrPair() or ARN check functions (e.g. testAccMatchResourceAttrRegionalARN)
  • Loading branch information
gdavison authored and adamdecaf committed May 28, 2020
1 parent d9a19fa commit 518ec42
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions aws/resource_aws_rds_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func testSweepRdsClusters(region string) error {

func TestAccAWSRDSCluster_basic(t *testing.T) {
var dbCluster rds.DBCluster
rInt := acctest.RandInt()
clusterName := acctest.RandomWithPrefix("tf-aurora-cluster")
resourceName := "aws_rds_cluster.test"

resource.ParallelTest(t, resource.TestCase{
Expand All @@ -111,10 +111,10 @@ func TestAccAWSRDSCluster_basic(t *testing.T) {
CheckDestroy: testAccCheckAWSClusterDestroy,
Steps: []resource.TestStep{
{
Config: testAccAWSClusterConfig(rInt),
Config: testAccAWSClusterConfig(clusterName),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSClusterExists(resourceName, &dbCluster),
resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(`^arn:[^:]+:rds:[^:]+:\d{12}:cluster:.+`)),
testAccCheckResourceAttrRegionalARN(resourceName, "arn", "rds", fmt.Sprintf("cluster:%s", clusterName)),
resource.TestCheckResourceAttr(resourceName, "backtrack_window", "0"),
resource.TestCheckResourceAttr(resourceName, "copy_tags_to_snapshot", "false"),
resource.TestCheckResourceAttr(resourceName, "storage_encrypted", "false"),
Expand Down Expand Up @@ -2141,17 +2141,17 @@ func TestAccAWSRDSCluster_EnableHttpEndpoint(t *testing.T) {
})
}

func testAccAWSClusterConfig(n int) string {
func testAccAWSClusterConfig(rName string) string {
return fmt.Sprintf(`
resource "aws_rds_cluster" "test" {
cluster_identifier = "tf-aurora-cluster-%d"
cluster_identifier = %[1]q
database_name = "mydb"
master_username = "foo"
master_password = "mustbeeightcharaters"
db_cluster_parameter_group_name = "default.aurora5.6"
skip_final_snapshot = true
}
`, n)
`, rName)
}

func testAccAWSClusterConfig_AvailabilityZones(rName string) string {
Expand Down

0 comments on commit 518ec42

Please sign in to comment.