diff --git a/provider/datasource_rediscloud_cloud_account_test.go b/provider/datasource_rediscloud_cloud_account_test.go index 75dc918b..0abb1e53 100644 --- a/provider/datasource_rediscloud_cloud_account_test.go +++ b/provider/datasource_rediscloud_cloud_account_test.go @@ -12,6 +12,8 @@ import ( func TestAccDataSourceRedisCloudCloudAccount_basic(t *testing.T) { name := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") + const testCloudAccount = "data.rediscloud_cloud_account.test" + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAwsPreExistingCloudAccountPreCheck(t) }, ProviderFactories: providerFactories, @@ -19,12 +21,11 @@ func TestAccDataSourceRedisCloudCloudAccount_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccDatasourceRedisCloudCloudAccountDataSource, name), - Check: resource.ComposeTestCheckFunc( - resource.TestMatchResourceAttr( - "data.rediscloud_cloud_account.test", "id", regexp.MustCompile("^\\d*$")), - resource.TestCheckResourceAttr("data.rediscloud_cloud_account.test", "provider_type", "AWS"), - resource.TestCheckResourceAttr("data.rediscloud_cloud_account.test", "name", name), - resource.TestCheckResourceAttrSet("data.rediscloud_cloud_account.test", "access_key_id"), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestMatchResourceAttr(testCloudAccount, "id", regexp.MustCompile("^\\d*$")), + resource.TestCheckResourceAttr(testCloudAccount, "provider_type", "AWS"), + resource.TestCheckResourceAttr(testCloudAccount, "name", name), + resource.TestCheckResourceAttrSet(testCloudAccount, "access_key_id"), ), }, }, diff --git a/provider/datasource_rediscloud_data_persistence_test.go b/provider/datasource_rediscloud_data_persistence_test.go index 60bbf480..7b7caa00 100644 --- a/provider/datasource_rediscloud_data_persistence_test.go +++ b/provider/datasource_rediscloud_data_persistence_test.go @@ -7,6 +7,7 @@ import ( ) func TestAccDataSourceRedisCloudDataPersistence_basic(t *testing.T) { + const dataPersistenceFoo = "data.rediscloud_data_persistence.foo" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: providerFactories, @@ -14,14 +15,14 @@ func TestAccDataSourceRedisCloudDataPersistence_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccDataSourceRedisCloudDataPersistence, - Check: resource.ComposeTestCheckFunc( - resource.TestCheckTypeSetElemNestedAttrs("data.rediscloud_data_persistence.foo", "data_persistence.*", map[string]string{ + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckTypeSetElemNestedAttrs(dataPersistenceFoo, "data_persistence.*", map[string]string{ "name": "snapshot-every-12-hours", }), - resource.TestCheckTypeSetElemNestedAttrs("data.rediscloud_data_persistence.foo", "data_persistence.*", map[string]string{ + resource.TestCheckTypeSetElemNestedAttrs(dataPersistenceFoo, "data_persistence.*", map[string]string{ "name": "snapshot-every-6-hours", }), - resource.TestCheckTypeSetElemNestedAttrs("data.rediscloud_data_persistence.foo", "data_persistence.*", map[string]string{ + resource.TestCheckTypeSetElemNestedAttrs(dataPersistenceFoo, "data_persistence.*", map[string]string{ "name": "snapshot-every-1-hour", }), ), diff --git a/provider/datasource_rediscloud_database_modules_test.go b/provider/datasource_rediscloud_database_modules_test.go index fb055c82..b6712207 100644 --- a/provider/datasource_rediscloud_database_modules_test.go +++ b/provider/datasource_rediscloud_database_modules_test.go @@ -14,7 +14,7 @@ func TestAccDataSourceRedisCloudDatabaseModules_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccDataSourceRedisCloudDatabaseModules, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckTypeSetElemNestedAttrs("data.rediscloud_database_modules.foo", "modules.*", map[string]string{ "name": "RedisBloom", }), diff --git a/provider/datasource_rediscloud_essentials_plan_test.go b/provider/datasource_rediscloud_essentials_plan_test.go index ce47f92f..6193cc60 100644 --- a/provider/datasource_rediscloud_essentials_plan_test.go +++ b/provider/datasource_rediscloud_essentials_plan_test.go @@ -8,6 +8,8 @@ import ( func TestAccDataSourceRedisCloudEssentialsPlan_basic(t *testing.T) { + const basicPlan = "data.rediscloud_essentials_plan.basic" + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: providerFactories, @@ -15,29 +17,29 @@ func TestAccDataSourceRedisCloudEssentialsPlan_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccDataSourceRedisCloudEssentialsPlan, - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "id", "34843"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "name", "30MB"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "size", "30"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "size_measurement_unit", "MB"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "cloud_provider", "AWS"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "region", "us-east-1"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "region_id", "1"), - resource.TestCheckResourceAttrSet("data.rediscloud_essentials_plan.basic", "price"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "price_currency", "USD"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "price_period", "Month"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "maximum_databases", "1"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "maximum_throughput", "100"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "maximum_bandwidth_in_gb", "5"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "availability", "No replication"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "connections", "30"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "cidr_allow_rules", "1"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "support_data_persistence", "false"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "support_instant_and_daily_backups", "false"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "support_replication", "false"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "support_clustering", "false"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "supported_alerts.#", "2"), - resource.TestCheckResourceAttr("data.rediscloud_essentials_plan.basic", "customer_support", "Basic"), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr(basicPlan, "id", "34843"), + resource.TestCheckResourceAttr(basicPlan, "name", "30MB"), + resource.TestCheckResourceAttr(basicPlan, "size", "30"), + resource.TestCheckResourceAttr(basicPlan, "size_measurement_unit", "MB"), + resource.TestCheckResourceAttr(basicPlan, "cloud_provider", "AWS"), + resource.TestCheckResourceAttr(basicPlan, "region", "us-east-1"), + resource.TestCheckResourceAttr(basicPlan, "region_id", "1"), + resource.TestCheckResourceAttrSet(basicPlan, "price"), + resource.TestCheckResourceAttr(basicPlan, "price_currency", "USD"), + resource.TestCheckResourceAttr(basicPlan, "price_period", "Month"), + resource.TestCheckResourceAttr(basicPlan, "maximum_databases", "1"), + resource.TestCheckResourceAttr(basicPlan, "maximum_throughput", "100"), + resource.TestCheckResourceAttr(basicPlan, "maximum_bandwidth_in_gb", "5"), + resource.TestCheckResourceAttr(basicPlan, "availability", "No replication"), + resource.TestCheckResourceAttr(basicPlan, "connections", "30"), + resource.TestCheckResourceAttr(basicPlan, "cidr_allow_rules", "1"), + resource.TestCheckResourceAttr(basicPlan, "support_data_persistence", "false"), + resource.TestCheckResourceAttr(basicPlan, "support_instant_and_daily_backups", "false"), + resource.TestCheckResourceAttr(basicPlan, "support_replication", "false"), + resource.TestCheckResourceAttr(basicPlan, "support_clustering", "false"), + resource.TestCheckResourceAttr(basicPlan, "supported_alerts.#", "2"), + resource.TestCheckResourceAttr(basicPlan, "customer_support", "Basic"), ), }, }, @@ -46,7 +48,8 @@ func TestAccDataSourceRedisCloudEssentialsPlan_basic(t *testing.T) { func TestAccDataSourceRedisCloudEssentialsPlan_azure(t *testing.T) { - const azureResource = "data.rediscloud_essentials_plan.azure" + const azurePlan = "data.rediscloud_essentials_plan.azure" + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: providerFactories, @@ -54,29 +57,29 @@ func TestAccDataSourceRedisCloudEssentialsPlan_azure(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccDataSourceRedisCloudEssentialsPlanAzure, - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(azureResource, "id", "35008"), - resource.TestCheckResourceAttr(azureResource, "name", "Single-Zone_Persistence_1GB"), - resource.TestCheckResourceAttr(azureResource, "size", "1"), - resource.TestCheckResourceAttr(azureResource, "size_measurement_unit", "GB"), - resource.TestCheckResourceAttr(azureResource, "cloud_provider", "Azure"), - resource.TestCheckResourceAttr(azureResource, "region", "west-us"), - resource.TestCheckResourceAttr(azureResource, "region_id", "17"), - resource.TestCheckResourceAttrSet(azureResource, "price"), - resource.TestCheckResourceAttr(azureResource, "price_currency", "USD"), - resource.TestCheckResourceAttr(azureResource, "price_period", "Month"), - resource.TestCheckResourceAttr(azureResource, "maximum_databases", "1"), - resource.TestCheckResourceAttr(azureResource, "maximum_throughput", "2000"), - resource.TestCheckResourceAttr(azureResource, "maximum_bandwidth_in_gb", "200"), - resource.TestCheckResourceAttr(azureResource, "availability", "Single-zone"), - resource.TestCheckResourceAttr(azureResource, "connections", "1024"), - resource.TestCheckResourceAttr(azureResource, "cidr_allow_rules", "8"), - resource.TestCheckResourceAttr(azureResource, "support_data_persistence", "true"), - resource.TestCheckResourceAttr(azureResource, "support_instant_and_daily_backups", "true"), - resource.TestCheckResourceAttr(azureResource, "support_replication", "true"), - resource.TestCheckResourceAttr(azureResource, "support_clustering", "false"), - resource.TestCheckResourceAttr(azureResource, "supported_alerts.#", "5"), - resource.TestCheckResourceAttr(azureResource, "customer_support", "Standard"), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr(azurePlan, "id", "35008"), + resource.TestCheckResourceAttr(azurePlan, "name", "Single-Zone_Persistence_1GB"), + resource.TestCheckResourceAttr(azurePlan, "size", "1"), + resource.TestCheckResourceAttr(azurePlan, "size_measurement_unit", "GB"), + resource.TestCheckResourceAttr(azurePlan, "cloud_provider", "Azure"), + resource.TestCheckResourceAttr(azurePlan, "region", "west-us"), + resource.TestCheckResourceAttr(azurePlan, "region_id", "17"), + resource.TestCheckResourceAttrSet(azurePlan, "price"), + resource.TestCheckResourceAttr(azurePlan, "price_currency", "USD"), + resource.TestCheckResourceAttr(azurePlan, "price_period", "Month"), + resource.TestCheckResourceAttr(azurePlan, "maximum_databases", "1"), + resource.TestCheckResourceAttr(azurePlan, "maximum_throughput", "2000"), + resource.TestCheckResourceAttr(azurePlan, "maximum_bandwidth_in_gb", "200"), + resource.TestCheckResourceAttr(azurePlan, "availability", "Single-zone"), + resource.TestCheckResourceAttr(azurePlan, "connections", "1024"), + resource.TestCheckResourceAttr(azurePlan, "cidr_allow_rules", "8"), + resource.TestCheckResourceAttr(azurePlan, "support_data_persistence", "true"), + resource.TestCheckResourceAttr(azurePlan, "support_instant_and_daily_backups", "true"), + resource.TestCheckResourceAttr(azurePlan, "support_replication", "true"), + resource.TestCheckResourceAttr(azurePlan, "support_clustering", "false"), + resource.TestCheckResourceAttr(azurePlan, "supported_alerts.#", "5"), + resource.TestCheckResourceAttr(azurePlan, "customer_support", "Standard"), ), }, }, @@ -85,7 +88,8 @@ func TestAccDataSourceRedisCloudEssentialsPlan_azure(t *testing.T) { func TestAccDataSourceRedisCloudEssentialsPlan_subscriptionId(t *testing.T) { - const exampleResource = "data.rediscloud_essentials_plan.example" + const examplePlan = "data.rediscloud_essentials_plan.example" + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: providerFactories, @@ -94,30 +98,30 @@ func TestAccDataSourceRedisCloudEssentialsPlan_subscriptionId(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccResourceRedisCloudPaidEssentialsSubscriptionDataSource, - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(exampleResource, "id", "34858"), - resource.TestCheckResourceAttr(exampleResource, "name", "250MB"), - resource.TestCheckResourceAttrSet(exampleResource, "subscription_id"), - resource.TestCheckResourceAttr(exampleResource, "size", "250"), - resource.TestCheckResourceAttr(exampleResource, "size_measurement_unit", "MB"), - resource.TestCheckResourceAttr(exampleResource, "cloud_provider", "AWS"), - resource.TestCheckResourceAttr(exampleResource, "region", "us-east-1"), - resource.TestCheckResourceAttr(exampleResource, "region_id", "1"), - resource.TestCheckResourceAttrSet(exampleResource, "price"), - resource.TestCheckResourceAttr(exampleResource, "price_currency", "USD"), - resource.TestCheckResourceAttr(exampleResource, "price_period", "Month"), - resource.TestCheckResourceAttr(exampleResource, "maximum_databases", "1"), - resource.TestCheckResourceAttr(exampleResource, "maximum_throughput", "1000"), - resource.TestCheckResourceAttr(exampleResource, "maximum_bandwidth_in_gb", "100"), - resource.TestCheckResourceAttr(exampleResource, "availability", "No replication"), - resource.TestCheckResourceAttr(exampleResource, "connections", "256"), - resource.TestCheckResourceAttr(exampleResource, "cidr_allow_rules", "4"), - resource.TestCheckResourceAttr(exampleResource, "support_data_persistence", "false"), - resource.TestCheckResourceAttr(exampleResource, "support_instant_and_daily_backups", "true"), - resource.TestCheckResourceAttr(exampleResource, "support_replication", "false"), - resource.TestCheckResourceAttr(exampleResource, "support_clustering", "false"), - resource.TestCheckResourceAttr(exampleResource, "supported_alerts.#", "5"), - resource.TestCheckResourceAttr(exampleResource, "customer_support", "Standard"), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr(examplePlan, "id", "34858"), + resource.TestCheckResourceAttr(examplePlan, "name", "250MB"), + resource.TestCheckResourceAttrSet(examplePlan, "subscription_id"), + resource.TestCheckResourceAttr(examplePlan, "size", "250"), + resource.TestCheckResourceAttr(examplePlan, "size_measurement_unit", "MB"), + resource.TestCheckResourceAttr(examplePlan, "cloud_provider", "AWS"), + resource.TestCheckResourceAttr(examplePlan, "region", "us-east-1"), + resource.TestCheckResourceAttr(examplePlan, "region_id", "1"), + resource.TestCheckResourceAttrSet(examplePlan, "price"), + resource.TestCheckResourceAttr(examplePlan, "price_currency", "USD"), + resource.TestCheckResourceAttr(examplePlan, "price_period", "Month"), + resource.TestCheckResourceAttr(examplePlan, "maximum_databases", "1"), + resource.TestCheckResourceAttr(examplePlan, "maximum_throughput", "1000"), + resource.TestCheckResourceAttr(examplePlan, "maximum_bandwidth_in_gb", "100"), + resource.TestCheckResourceAttr(examplePlan, "availability", "No replication"), + resource.TestCheckResourceAttr(examplePlan, "connections", "256"), + resource.TestCheckResourceAttr(examplePlan, "cidr_allow_rules", "4"), + resource.TestCheckResourceAttr(examplePlan, "support_data_persistence", "false"), + resource.TestCheckResourceAttr(examplePlan, "support_instant_and_daily_backups", "true"), + resource.TestCheckResourceAttr(examplePlan, "support_replication", "false"), + resource.TestCheckResourceAttr(examplePlan, "support_clustering", "false"), + resource.TestCheckResourceAttr(examplePlan, "supported_alerts.#", "5"), + resource.TestCheckResourceAttr(examplePlan, "customer_support", "Standard"), ), }, }, diff --git a/provider/datasource_rediscloud_payment_method_test.go b/provider/datasource_rediscloud_payment_method_test.go index fcadc3c1..8b300101 100644 --- a/provider/datasource_rediscloud_payment_method_test.go +++ b/provider/datasource_rediscloud_payment_method_test.go @@ -15,7 +15,7 @@ func TestAccDataSourceRedisCloudPaymentMethod_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccDataSourceRedisCloudPaymentMethod, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestMatchResourceAttr( "data.rediscloud_payment_method.foo", "id", regexp.MustCompile("^\\d*$")), resource.TestMatchResourceAttr( diff --git a/provider/datasource_rediscloud_pro_database_test.go b/provider/datasource_rediscloud_pro_database_test.go index b36b1316..1105c9d5 100644 --- a/provider/datasource_rediscloud_pro_database_test.go +++ b/provider/datasource_rediscloud_pro_database_test.go @@ -14,8 +14,8 @@ func TestAccDataSourceRedisCloudProDatabase_basic(t *testing.T) { password := acctest.RandString(20) testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") - dataSourceById := "data.rediscloud_database.example-by-id" - dataSourceByName := "data.rediscloud_database.example-by-name" + const dataSourceById = "data.rediscloud_database.example-by-id" + const dataSourceByName = "data.rediscloud_database.example-by-name" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAwsPreExistingCloudAccountPreCheck(t) }, @@ -24,7 +24,7 @@ func TestAccDataSourceRedisCloudProDatabase_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccDatasourceRedisCloudProDatabase, testCloudAccountName, name, password), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(dataSourceById, "name", "tf-database"), resource.TestCheckResourceAttr(dataSourceById, "protocol", "redis"), resource.TestCheckResourceAttr(dataSourceById, "region", "eu-west-1"), diff --git a/provider/datasource_rediscloud_pro_subscription_test.go b/provider/datasource_rediscloud_pro_subscription_test.go index 2c9fbac0..1098a475 100644 --- a/provider/datasource_rediscloud_pro_subscription_test.go +++ b/provider/datasource_rediscloud_pro_subscription_test.go @@ -13,8 +13,8 @@ import ( func TestAccDataSourceRedisCloudProSubscription_basic(t *testing.T) { name := acctest.RandomWithPrefix("tf-test") - resourceName := "rediscloud_subscription.example" - dataSourceName := "data.rediscloud_subscription.example" + const resourceName = "rediscloud_subscription.example" + const dataSourceName = "data.rediscloud_subscription.example" testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") resource.ParallelTest(t, resource.TestCase{ @@ -24,13 +24,13 @@ func TestAccDataSourceRedisCloudProSubscription_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccDatasourceRedisCloudProSubscription, testCloudAccountName, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestMatchResourceAttr(resourceName, "name", regexp.MustCompile(name)), ), }, { Config: fmt.Sprintf(testAccDatasourceRedisCloudProSubscriptionDataSource, name) + fmt.Sprintf(testAccDatasourceRedisCloudProSubscription, testCloudAccountName, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestMatchResourceAttr(dataSourceName, "name", regexp.MustCompile(name)), resource.TestCheckResourceAttr(dataSourceName, "payment_method", "credit-card"), resource.TestCheckResourceAttrSet(dataSourceName, "payment_method_id"), diff --git a/provider/datasource_rediscloud_regions_test.go b/provider/datasource_rediscloud_regions_test.go index 2d3f03be..6f0dbb91 100644 --- a/provider/datasource_rediscloud_regions_test.go +++ b/provider/datasource_rediscloud_regions_test.go @@ -14,7 +14,7 @@ func TestAccDataSourceRedisCloudRegions_all(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccDataSourceRedisCloudRegions, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckTypeSetElemNestedAttrs("data.rediscloud_regions.foo", "regions.*", map[string]string{ "name": "europe-west1", }), @@ -47,7 +47,7 @@ func TestAccDataSourceRedisCloudRegions_AWS(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccDataSourceRedisCloudRegionsAWS, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckTypeSetElemNestedAttrs("data.rediscloud_regions.foo", "regions.*", map[string]string{ "name": "eu-west-1", }), @@ -71,7 +71,7 @@ func TestAccDataSourceRedisCloudRegions_GCP(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccDataSourceRedisCloudRegionsGCP, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckTypeSetElemNestedAttrs("data.rediscloud_regions.foo", "regions.*", map[string]string{ "name": "europe-west1", }), diff --git a/provider/datasource_rediscloud_subscription_peerings_test.go b/provider/datasource_rediscloud_subscription_peerings_test.go index a2f0701f..7d32aaf4 100644 --- a/provider/datasource_rediscloud_subscription_peerings_test.go +++ b/provider/datasource_rediscloud_subscription_peerings_test.go @@ -16,7 +16,7 @@ func TestAccDataSourceRedisCloudSubscriptionPeerings_basic(t *testing.T) { testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") // Chose a CIDR range for the subscription that's unlikely to overlap with any VPC CIDR - subCidrRange := "10.0.0.0/24" + const subCidrRange = "10.0.0.0/24" awsAccountId := os.Getenv("AWS_ACCOUNT_ID") awsVPCId := os.Getenv("AWS_VPC_ID") @@ -31,7 +31,7 @@ func TestAccDataSourceRedisCloudSubscriptionPeerings_basic(t *testing.T) { awsVPCId, awsVPCCidr, ) - dataSourceName := "data.rediscloud_subscription_peerings.example" + const dataSourceName = "data.rediscloud_subscription_peerings.example" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAwsPeeringPreCheck(t); testAccAwsPreExistingCloudAccountPreCheck(t) }, @@ -40,7 +40,7 @@ func TestAccDataSourceRedisCloudSubscriptionPeerings_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: tf, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestMatchTypeSetElemNestedAttrs(dataSourceName, "peerings.*", map[string]*regexp.Regexp{ "provider_name": regexp.MustCompile("AWS"), "aws_account_id": regexp.MustCompile(awsAccountId), diff --git a/provider/rediscloud_acl_role_test.go b/provider/rediscloud_acl_role_test.go index 347503b7..cda31151 100644 --- a/provider/rediscloud_acl_role_test.go +++ b/provider/rediscloud_acl_role_test.go @@ -32,6 +32,9 @@ func TestAccCreateReadUpdateImportDeleteAclRole_Pro(t *testing.T) { fmt.Sprintf(referencableRule, exampleRuleName) + fmt.Sprintf(testRole, testRoleNameUpdated) + const testAclRole = "rediscloud_acl_role.test" + const testAclRoleData = "data.rediscloud_acl_role.test" + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAwsPreExistingCloudAccountPreCheck(t) }, ProviderFactories: providerFactories, @@ -41,19 +44,19 @@ func TestAccCreateReadUpdateImportDeleteAclRole_Pro(t *testing.T) { // Test role creation including association with database { Config: testCreateTerraform, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test the resource - resource.TestCheckResourceAttr("rediscloud_acl_role.test", "name", testRoleName), - resource.TestCheckResourceAttr("rediscloud_acl_role.test", "rule.#", "1"), - resource.TestCheckResourceAttr("rediscloud_acl_role.test", "rule.0.name", exampleRuleName), - resource.TestCheckResourceAttr("rediscloud_acl_role.test", "rule.0.database.#", "1"), - resource.TestMatchResourceAttr("rediscloud_acl_role.test", "rule.0.database.0.subscription", regexp.MustCompile("^\\d*$")), - resource.TestMatchResourceAttr("rediscloud_acl_role.test", "rule.0.database.0.database", regexp.MustCompile("^\\d*$")), - resource.TestCheckResourceAttr("rediscloud_acl_role.test", "rule.0.database.0.regions.#", "0"), + resource.TestCheckResourceAttr(testAclRole, "name", testRoleName), + resource.TestCheckResourceAttr(testAclRole, "rule.#", "1"), + resource.TestCheckResourceAttr(testAclRole, "rule.0.name", exampleRuleName), + resource.TestCheckResourceAttr(testAclRole, "rule.0.database.#", "1"), + resource.TestMatchResourceAttr(testAclRole, "rule.0.database.0.subscription", regexp.MustCompile("^\\d*$")), + resource.TestMatchResourceAttr(testAclRole, "rule.0.database.0.database", regexp.MustCompile("^\\d*$")), + resource.TestCheckResourceAttr(testAclRole, "rule.0.database.0.regions.#", "0"), // Test role exists func(s *terraform.State) error { - r := s.RootModule().Resources["rediscloud_acl_role.test"] + r := s.RootModule().Resources[testAclRole] id, err := strconv.Atoi(r.Primary.ID) if err != nil { @@ -75,45 +78,45 @@ func TestAccCreateReadUpdateImportDeleteAclRole_Pro(t *testing.T) { // Test the datasource resource.TestMatchResourceAttr( - "data.rediscloud_acl_role.test", "id", regexp.MustCompile("^\\d*$")), - resource.TestCheckResourceAttr("data.rediscloud_acl_role.test", "name", testRoleName), - resource.TestCheckResourceAttr("data.rediscloud_acl_role.test", "rule.#", "1"), - resource.TestCheckResourceAttr("data.rediscloud_acl_role.test", "rule.0.name", exampleRuleName), - resource.TestCheckResourceAttr("data.rediscloud_acl_role.test", "rule.0.database.#", "1"), - resource.TestMatchResourceAttr("data.rediscloud_acl_role.test", "rule.0.database.0.subscription", regexp.MustCompile("^\\d*$")), - resource.TestMatchResourceAttr("data.rediscloud_acl_role.test", "rule.0.database.0.database", regexp.MustCompile("^\\d*$")), - resource.TestCheckResourceAttr("data.rediscloud_acl_role.test", "rule.0.database.0.regions.#", "0"), + testAclRoleData, "id", regexp.MustCompile("^\\d*$")), + resource.TestCheckResourceAttr(testAclRoleData, "name", testRoleName), + resource.TestCheckResourceAttr(testAclRoleData, "rule.#", "1"), + resource.TestCheckResourceAttr(testAclRoleData, "rule.0.name", exampleRuleName), + resource.TestCheckResourceAttr(testAclRoleData, "rule.0.database.#", "1"), + resource.TestMatchResourceAttr(testAclRoleData, "rule.0.database.0.subscription", regexp.MustCompile("^\\d*$")), + resource.TestMatchResourceAttr(testAclRoleData, "rule.0.database.0.database", regexp.MustCompile("^\\d*$")), + resource.TestCheckResourceAttr(testAclRoleData, "rule.0.database.0.regions.#", "0"), ), }, // Test role update { Config: testUpdateTerraform, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test the resource - resource.TestCheckResourceAttr("rediscloud_acl_role.test", "name", testRoleNameUpdated), - resource.TestCheckResourceAttr("rediscloud_acl_role.test", "rule.#", "1"), - resource.TestCheckResourceAttr("rediscloud_acl_role.test", "rule.0.name", exampleRuleName), - resource.TestCheckResourceAttr("rediscloud_acl_role.test", "rule.0.database.#", "1"), - resource.TestMatchResourceAttr("rediscloud_acl_role.test", "rule.0.database.0.subscription", regexp.MustCompile("^\\d*$")), - resource.TestMatchResourceAttr("rediscloud_acl_role.test", "rule.0.database.0.database", regexp.MustCompile("^\\d*$")), - resource.TestCheckResourceAttr("rediscloud_acl_role.test", "rule.0.database.0.regions.#", "0"), + resource.TestCheckResourceAttr(testAclRole, "name", testRoleNameUpdated), + resource.TestCheckResourceAttr(testAclRole, "rule.#", "1"), + resource.TestCheckResourceAttr(testAclRole, "rule.0.name", exampleRuleName), + resource.TestCheckResourceAttr(testAclRole, "rule.0.database.#", "1"), + resource.TestMatchResourceAttr(testAclRole, "rule.0.database.0.subscription", regexp.MustCompile("^\\d*$")), + resource.TestMatchResourceAttr(testAclRole, "rule.0.database.0.database", regexp.MustCompile("^\\d*$")), + resource.TestCheckResourceAttr(testAclRole, "rule.0.database.0.regions.#", "0"), // Test the datasource resource.TestMatchResourceAttr( - "data.rediscloud_acl_role.test", "id", regexp.MustCompile("^\\d*$")), - resource.TestCheckResourceAttr("data.rediscloud_acl_role.test", "name", testRoleNameUpdated), - resource.TestCheckResourceAttr("data.rediscloud_acl_role.test", "rule.#", "1"), - resource.TestCheckResourceAttr("data.rediscloud_acl_role.test", "rule.0.name", exampleRuleName), - resource.TestCheckResourceAttr("data.rediscloud_acl_role.test", "rule.0.database.#", "1"), - resource.TestMatchResourceAttr("data.rediscloud_acl_role.test", "rule.0.database.0.subscription", regexp.MustCompile("^\\d*$")), - resource.TestMatchResourceAttr("data.rediscloud_acl_role.test", "rule.0.database.0.database", regexp.MustCompile("^\\d*$")), - resource.TestCheckResourceAttr("data.rediscloud_acl_role.test", "rule.0.database.0.regions.#", "0"), + testAclRoleData, "id", regexp.MustCompile("^\\d*$")), + resource.TestCheckResourceAttr(testAclRoleData, "name", testRoleNameUpdated), + resource.TestCheckResourceAttr(testAclRoleData, "rule.#", "1"), + resource.TestCheckResourceAttr(testAclRoleData, "rule.0.name", exampleRuleName), + resource.TestCheckResourceAttr(testAclRoleData, "rule.0.database.#", "1"), + resource.TestMatchResourceAttr(testAclRoleData, "rule.0.database.0.subscription", regexp.MustCompile("^\\d*$")), + resource.TestMatchResourceAttr(testAclRoleData, "rule.0.database.0.database", regexp.MustCompile("^\\d*$")), + resource.TestCheckResourceAttr(testAclRoleData, "rule.0.database.0.regions.#", "0"), ), }, // Test that the role is imported successfully { Config: fmt.Sprintf(testRole, testRoleNameUpdated), - ResourceName: "rediscloud_acl_role.test", + ResourceName: testAclRole, ImportState: true, ImportStateVerify: true, }, diff --git a/provider/rediscloud_acl_rule_test.go b/provider/rediscloud_acl_rule_test.go index 25216b42..902fc49f 100644 --- a/provider/rediscloud_acl_rule_test.go +++ b/provider/rediscloud_acl_rule_test.go @@ -14,10 +14,11 @@ import ( func TestAccRedisCloudAclRule_DataSourceForDefaultRule(t *testing.T) { // This rule already exists - testName := "Read-Write" - testRule := "+@all -@dangerous ~*" + const testName = "Read-Write" + const testRule = "+@all -@dangerous ~*" getRuleTerraform := fmt.Sprintf(getDefaultAclRuleDataSource, testName) + const AclRuleTest = "data.rediscloud_acl_rule.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: providerFactories, @@ -25,11 +26,11 @@ func TestAccRedisCloudAclRule_DataSourceForDefaultRule(t *testing.T) { Steps: []resource.TestStep{ { Config: getRuleTerraform, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestMatchResourceAttr( - "data.rediscloud_acl_rule.test", "id", regexp.MustCompile("^\\d*$")), - resource.TestCheckResourceAttr("data.rediscloud_acl_rule.test", "name", testName), - resource.TestCheckResourceAttr("data.rediscloud_acl_rule.test", "rule", testRule), + AclRuleTest, "id", regexp.MustCompile("^\\d*$")), + resource.TestCheckResourceAttr(AclRuleTest, "name", testName), + resource.TestCheckResourceAttr(AclRuleTest, "rule", testRule), ), }, }, @@ -40,15 +41,18 @@ func TestAccRedisCloudAclRule_CRUDI(t *testing.T) { prefix := acctest.RandomWithPrefix(testResourcePrefix) testName := prefix + "-test-rule" - testRule := "+@all" + const testRule = "+@all" testNameUpdated := testName + "_updated_name" - testRuleUpdated := testRule + " -@dangerous ~*" + const testRuleUpdated = testRule + " -@dangerous ~*" testCreateTerraform := fmt.Sprintf(testRedisRule, testName, testRule) testUpdateRuleTerraform := fmt.Sprintf(testRedisRule, testName, testRuleUpdated) testUpdateNameTerraform := fmt.Sprintf(testRedisRule, testNameUpdated, testRuleUpdated) + const AclRuleTest = "rediscloud_acl_rule.test" + const AclRuleTestData = "data.rediscloud_acl_rule.test" + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProviderFactories: providerFactories, @@ -57,14 +61,14 @@ func TestAccRedisCloudAclRule_CRUDI(t *testing.T) { // Test rule creation { Config: testCreateTerraform, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test the resource - resource.TestCheckResourceAttr("rediscloud_acl_rule.test", "name", testName), - resource.TestCheckResourceAttr("rediscloud_acl_rule.test", "rule", testRule), + resource.TestCheckResourceAttr(AclRuleTest, "name", testName), + resource.TestCheckResourceAttr(AclRuleTest, "rule", testRule), // Test rule exists func(s *terraform.State) error { - r := s.RootModule().Resources["rediscloud_acl_rule.test"] + r := s.RootModule().Resources[AclRuleTest] var err error id, err := strconv.Atoi(r.Primary.ID) @@ -89,14 +93,14 @@ func TestAccRedisCloudAclRule_CRUDI(t *testing.T) { // Test the datasource resource.TestMatchResourceAttr( - "data.rediscloud_acl_rule.test", "id", regexp.MustCompile("^\\d*$")), - resource.TestCheckResourceAttr("data.rediscloud_acl_rule.test", "name", testName), - resource.TestCheckResourceAttr("data.rediscloud_acl_rule.test", "rule", testRule), + AclRuleTestData, "id", regexp.MustCompile("^\\d*$")), + resource.TestCheckResourceAttr(AclRuleTestData, "name", testName), + resource.TestCheckResourceAttr(AclRuleTestData, "rule", testRule), ), }, { Config: testUpdateRuleTerraform, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test the resource resource.TestCheckResourceAttr("rediscloud_acl_rule.test", "name", testName), resource.TestCheckResourceAttr("rediscloud_acl_rule.test", "rule", testRuleUpdated), @@ -109,21 +113,21 @@ func TestAccRedisCloudAclRule_CRUDI(t *testing.T) { }, { Config: testUpdateNameTerraform, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test the resource - resource.TestCheckResourceAttr("rediscloud_acl_rule.test", "name", testNameUpdated), - resource.TestCheckResourceAttr("rediscloud_acl_rule.test", "rule", testRuleUpdated), + resource.TestCheckResourceAttr(AclRuleTest, "name", testNameUpdated), + resource.TestCheckResourceAttr(AclRuleTest, "rule", testRuleUpdated), // Test the datasource resource.TestMatchResourceAttr( - "data.rediscloud_acl_rule.test", "id", regexp.MustCompile("^\\d*$")), - resource.TestCheckResourceAttr("data.rediscloud_acl_rule.test", "name", testNameUpdated), - resource.TestCheckResourceAttr("data.rediscloud_acl_rule.test", "rule", testRuleUpdated), + AclRuleTestData, "id", regexp.MustCompile("^\\d*$")), + resource.TestCheckResourceAttr(AclRuleTestData, "name", testNameUpdated), + resource.TestCheckResourceAttr(AclRuleTestData, "rule", testRuleUpdated), ), }, // Test full update { Config: testCreateTerraform, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test the resource resource.TestCheckResourceAttr("rediscloud_acl_rule.test", "name", testName), resource.TestCheckResourceAttr("rediscloud_acl_rule.test", "rule", testRule), @@ -137,7 +141,7 @@ func TestAccRedisCloudAclRule_CRUDI(t *testing.T) { // Test that that rule is imported successfully { Config: fmt.Sprintf(testRedisRule, testNameUpdated, testRuleUpdated), - ResourceName: "rediscloud_acl_rule.test", + ResourceName: AclRuleTest, ImportState: true, ImportStateVerify: true, }, diff --git a/provider/rediscloud_acl_user_test.go b/provider/rediscloud_acl_user_test.go index ecad88b3..b85cc433 100644 --- a/provider/rediscloud_acl_user_test.go +++ b/provider/rediscloud_acl_user_test.go @@ -47,6 +47,9 @@ func TestAccResourceRedisCloudAclUser_CRUDI(t *testing.T) { identifier := "" + const AclUserTest = "rediscloud_acl_user.test" + const AclUserTestData = "data.rediscloud_acl_user.test" + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAwsPreExistingCloudAccountPreCheck(t) }, ProviderFactories: providerFactories, @@ -55,21 +58,21 @@ func TestAccResourceRedisCloudAclUser_CRUDI(t *testing.T) { // Test user creation { Config: testCreateTerraform, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test resource - resource.TestCheckResourceAttr("rediscloud_acl_user.test", "name", testUserName), - resource.TestCheckResourceAttr("rediscloud_acl_user.test", "role", exampleRoleName), + resource.TestCheckResourceAttr(AclUserTest, "name", testUserName), + resource.TestCheckResourceAttr(AclUserTest, "role", exampleRoleName), // Take a snapshot of the ID func(s *terraform.State) error { - r := s.RootModule().Resources["rediscloud_acl_user.test"] + r := s.RootModule().Resources[AclUserTest] identifier = r.Primary.ID return nil }, // Test user exists func(s *terraform.State) error { - r := s.RootModule().Resources["rediscloud_acl_user.test"] + r := s.RootModule().Resources[AclUserTest] id, err := strconv.Atoi(r.Primary.ID) if err != nil { @@ -94,21 +97,21 @@ func TestAccResourceRedisCloudAclUser_CRUDI(t *testing.T) { // Test datasource resource.TestMatchResourceAttr( - "data.rediscloud_acl_user.test", "id", regexp.MustCompile("^\\d*$")), - resource.TestCheckResourceAttr("data.rediscloud_acl_user.test", "name", testUserName), - resource.TestCheckResourceAttr("data.rediscloud_acl_user.test", "role", exampleRoleName), + AclUserTestData, "id", regexp.MustCompile("^\\d*$")), + resource.TestCheckResourceAttr(AclUserTestData, "name", testUserName), + resource.TestCheckResourceAttr(AclUserTestData, "role", exampleRoleName), ), }, // Test user update, id should not have changed { Config: testUpdateTerraform, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test resource - resource.TestCheckResourceAttr("rediscloud_acl_user.test", "name", testUserName), - resource.TestCheckResourceAttr("rediscloud_acl_user.test", "role", exampleRoleNameUpdated), + resource.TestCheckResourceAttr(AclUserTest, "name", testUserName), + resource.TestCheckResourceAttr(AclUserTest, "role", exampleRoleNameUpdated), func(s *terraform.State) error { - r := s.RootModule().Resources["rediscloud_acl_user.test"] + r := s.RootModule().Resources[AclUserTest] if r.Primary.ID != identifier { return fmt.Errorf("entity should have the same identifier, but has changed from %s to %s", identifier, r.Primary.ID) } @@ -117,18 +120,18 @@ func TestAccResourceRedisCloudAclUser_CRUDI(t *testing.T) { // Test datasource resource.TestMatchResourceAttr( - "data.rediscloud_acl_user.test", "id", regexp.MustCompile("^\\d*$")), - resource.TestCheckResourceAttr("data.rediscloud_acl_user.test", "name", testUserName), - resource.TestCheckResourceAttr("data.rediscloud_acl_user.test", "role", exampleRoleNameUpdated), + AclUserTestData, "id", regexp.MustCompile("^\\d*$")), + resource.TestCheckResourceAttr(AclUserTestData, "name", testUserName), + resource.TestCheckResourceAttr(AclUserTestData, "role", exampleRoleNameUpdated), ), }, // Test user is updated successfully. A name change should forcibly generate a new entity with a new id // Take a snapshot of this new id { Config: testNewNameTerraform, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( func(s *terraform.State) error { - r := s.RootModule().Resources["rediscloud_acl_user.test"] + r := s.RootModule().Resources[AclUserTest] if r.Primary.ID == identifier { return fmt.Errorf("entity should have a new identifier, but is still: %s", identifier) } @@ -140,9 +143,9 @@ func TestAccResourceRedisCloudAclUser_CRUDI(t *testing.T) { // Test user is updated successfully. A password change should forcibly generate a new entity with a new id { Config: testNewPasswordTerraform, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( func(s *terraform.State) error { - r := s.RootModule().Resources["rediscloud_acl_user.test"] + r := s.RootModule().Resources[AclUserTest] if r.Primary.ID == identifier { return fmt.Errorf("entity should have a new identifier, but is still: %s", identifier) } @@ -153,7 +156,7 @@ func TestAccResourceRedisCloudAclUser_CRUDI(t *testing.T) { // Test that the user is imported successfully { Config: fmt.Sprintf(testUser, testUserNameUpdated, testUserPasswordUpdated), - ResourceName: "rediscloud_acl_user.test", + ResourceName: AclUserTest, ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"password"}, diff --git a/provider/rediscloud_active_active_database_test.go b/provider/rediscloud_active_active_database_test.go index f5a5f26e..b72357ff 100644 --- a/provider/rediscloud_active_active_database_test.go +++ b/provider/rediscloud_active_active_database_test.go @@ -20,9 +20,9 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) { subscriptionName := acctest.RandomWithPrefix(testResourcePrefix) + "-subscription" name := acctest.RandomWithPrefix(testResourcePrefix) + "-database" password := acctest.RandString(20) - resourceName := "rediscloud_active_active_subscription_database.example" - datasourceName := "data.rediscloud_active_active_subscription_database.example" - subscriptionResourceName := "rediscloud_active_active_subscription.example" + const resourceName = "rediscloud_active_active_subscription_database.example" + const datasourceName = "data.rediscloud_active_active_subscription_database.example" + const subscriptionResourceName = "rediscloud_active_active_subscription.example" var subId int @@ -34,7 +34,7 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) { // Test database creation { Config: fmt.Sprintf(testAccResourceRedisCloudActiveActiveDatabase, subscriptionName, name, password), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test resource resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttr(resourceName, "memory_limit_in_gb", "3"), @@ -116,7 +116,7 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) { // Test database is updated successfully, including updates to both global and local alerts and clearing modules { Config: fmt.Sprintf(testAccResourceRedisCloudActiveActiveDatabaseUpdate, subscriptionName, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test resource resource.TestCheckResourceAttr(resourceName, "memory_limit_in_gb", "1"), resource.TestCheckResourceAttr(resourceName, "support_oss_cluster_api", "true"), @@ -149,7 +149,7 @@ func TestAccResourceRedisCloudActiveActiveDatabase_CRUDI(t *testing.T) { // Test database is updated, including deletion of global and local alerts and replacing modules { Config: fmt.Sprintf(testAccResourceRedisCloudActiveActiveDatabaseUpdateNoAlerts, subscriptionName, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "memory_limit_in_gb", "1"), resource.TestCheckResourceAttr(resourceName, "support_oss_cluster_api", "true"), resource.TestCheckResourceAttr(resourceName, "external_endpoint_for_oss_cluster_api", "true"), @@ -206,7 +206,7 @@ func TestAccResourceRedisCloudActiveActiveDatabase_optionalAttributes(t *testing subscriptionName := acctest.RandomWithPrefix(testResourcePrefix) + "-subscription" name := acctest.RandomWithPrefix(testResourcePrefix) + "-database" password := acctest.RandString(20) - resourceName := "rediscloud_active_active_subscription_database.example" + const resourceName = "rediscloud_active_active_subscription_database.example" portNumber := 10101 resource.ParallelTest(t, resource.TestCase{ @@ -216,7 +216,7 @@ func TestAccResourceRedisCloudActiveActiveDatabase_optionalAttributes(t *testing Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudActiveActiveDatabaseOptionalAttributes, subscriptionName, name, password, portNumber), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "port", strconv.Itoa(portNumber)), ), }, diff --git a/provider/rediscloud_active_active_subscription_test.go b/provider/rediscloud_active_active_subscription_test.go index b3e43878..35003f3e 100644 --- a/provider/rediscloud_active_active_subscription_test.go +++ b/provider/rediscloud_active_active_subscription_test.go @@ -24,8 +24,8 @@ var activeActiveMarketplaceFlag = flag.Bool("activeActiveMarketplace", false, func TestAccResourceRedisCloudActiveActiveSubscription_CRUDI(t *testing.T) { name := acctest.RandomWithPrefix(testResourcePrefix) - resourceName := "rediscloud_active_active_subscription.example" - datasourceName := "data.rediscloud_active_active_subscription.example" + const resourceName = "rediscloud_active_active_subscription.example" + const datasourceName = "data.rediscloud_active_active_subscription.example" var subId int @@ -36,7 +36,7 @@ func TestAccResourceRedisCloudActiveActiveSubscription_CRUDI(t *testing.T) { Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudActiveActiveSubscription, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test the resource resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttr(resourceName, "payment_method", "credit-card"), @@ -163,7 +163,7 @@ func TestAccResourceRedisCloudActiveActiveSubscription_CRUDI(t *testing.T) { { // Checks if the changes in the creation plan are ignored. Config: fmt.Sprintf(testAccResourceRedisCloudActiveActiveSubscriptionNoCreationPlan, name, "AWS"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttr(resourceName, "cloud_provider", "AWS"), resource.TestCheckResourceAttr(resourceName, "creation_plan.#", "1"), @@ -188,7 +188,7 @@ func TestAccResourceRedisCloudActiveActiveSubscription_CRUDI(t *testing.T) { { // Checks if the changes to the payment_method are ignored. Config: fmt.Sprintf(testAccResourceRedisCloudActiveActiveSubscriptionChangedPaymentMethod, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "payment_method", "credit-card"), ), }, @@ -226,7 +226,7 @@ func TestAccResourceRedisCloudActiveActiveSubscription_createUpdateContractPayme name := acctest.RandomWithPrefix(testResourcePrefix) updatedName := fmt.Sprintf("%v-updatedName", name) - resourceName := "rediscloud_active_active_subscription.example" + const resourceName = "rediscloud_active_active_subscription.example" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAwsPreExistingCloudAccountPreCheck(t) }, @@ -235,7 +235,7 @@ func TestAccResourceRedisCloudActiveActiveSubscription_createUpdateContractPayme Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudActiveActiveSubscriptionContractPayment, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttr(resourceName, "cloud_provider.0.provider", "AWS"), resource.TestCheckResourceAttr(resourceName, "creation_plan.0.region.#", "2"), @@ -247,7 +247,7 @@ func TestAccResourceRedisCloudActiveActiveSubscription_createUpdateContractPayme }, { Config: fmt.Sprintf(testAccResourceRedisCloudActiveActiveSubscriptionContractPayment, updatedName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "payment_method_id"), resource.TestCheckResourceAttr(resourceName, "name", updatedName), ), @@ -264,7 +264,7 @@ func TestAccResourceRedisCloudActiveActiveSubscription_createUpdateMarketplacePa name := acctest.RandomWithPrefix(testResourcePrefix) updatedName := fmt.Sprintf("%v-updatedName", name) - resourceName := "rediscloud_active_active_subscription.example" + const resourceName = "rediscloud_active_active_subscription.example" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAwsPreExistingCloudAccountPreCheck(t) }, @@ -273,7 +273,7 @@ func TestAccResourceRedisCloudActiveActiveSubscription_createUpdateMarketplacePa Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudActiveActiveSubscriptionMarketplacePayment, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttr(resourceName, "cloud_provider.0.provider", "AWS"), resource.TestCheckResourceAttrSet(resourceName, "payment_method_id"), @@ -286,7 +286,7 @@ func TestAccResourceRedisCloudActiveActiveSubscription_createUpdateMarketplacePa }, { Config: fmt.Sprintf(testAccResourceRedisCloudActiveActiveSubscriptionMarketplacePayment, updatedName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", updatedName), ), }, diff --git a/provider/rediscloud_essentials_database_test.go b/provider/rediscloud_essentials_database_test.go index 6cde9be9..e35e29ae 100644 --- a/provider/rediscloud_essentials_database_test.go +++ b/provider/rediscloud_essentials_database_test.go @@ -14,8 +14,8 @@ func TestAccRedisCloudEssentialsDatabase_BasicCRUDI(t *testing.T) { databaseName := subscriptionName + "-db" databaseNameUpdated := databaseName + "-updated" - resourceName := "rediscloud_essentials_database.example" - datasourceName := "data.rediscloud_essentials_database.example" + const resourceName = "rediscloud_essentials_database.example" + const datasourceName = "data.rediscloud_essentials_database.example" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -24,7 +24,7 @@ func TestAccRedisCloudEssentialsDatabase_BasicCRUDI(t *testing.T) { Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudEssentialsDatabaseBasic, subscriptionName, databaseName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test the resource resource.TestMatchResourceAttr(resourceName, "id", regexp.MustCompile("^\\d+/\\d+$")), resource.TestCheckResourceAttrSet(resourceName, "subscription_id"), @@ -87,7 +87,7 @@ func TestAccRedisCloudEssentialsDatabase_BasicCRUDI(t *testing.T) { }, { Config: fmt.Sprintf(testAccResourceRedisCloudEssentialsDatabaseBasic, subscriptionName, databaseNameUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test the resource resource.TestMatchResourceAttr(resourceName, "id", regexp.MustCompile("^\\d+/\\d+$")), resource.TestCheckResourceAttrSet(resourceName, "subscription_id"), diff --git a/provider/rediscloud_essentials_subscription_test.go b/provider/rediscloud_essentials_subscription_test.go index 535158c7..b69cf2a2 100644 --- a/provider/rediscloud_essentials_subscription_test.go +++ b/provider/rediscloud_essentials_subscription_test.go @@ -16,8 +16,8 @@ func TestAccResourceRedisCloudEssentialsSubscription_FreeCRUDI(t *testing.T) { subscriptionName := acctest.RandomWithPrefix(testResourcePrefix) subscriptionNameUpdated := subscriptionName + "-updated" - resourceName := "rediscloud_essentials_subscription.example" - datasourceName := "data.rediscloud_essentials_subscription.example" + const resourceName = "rediscloud_essentials_subscription.example" + const datasourceName = "data.rediscloud_essentials_subscription.example" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -26,7 +26,7 @@ func TestAccResourceRedisCloudEssentialsSubscription_FreeCRUDI(t *testing.T) { Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudFreeEssentialsSubscription, subscriptionName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test the resource resource.TestCheckResourceAttrSet(resourceName, "id"), resource.TestCheckResourceAttr(resourceName, "name", subscriptionName), @@ -46,7 +46,7 @@ func TestAccResourceRedisCloudEssentialsSubscription_FreeCRUDI(t *testing.T) { }, { Config: fmt.Sprintf(testAccResourceRedisCloudFreeEssentialsSubscription, subscriptionNameUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test the resource resource.TestCheckResourceAttrSet(resourceName, "id"), resource.TestCheckResourceAttr(resourceName, "name", subscriptionNameUpdated), @@ -79,8 +79,8 @@ func TestAccResourceRedisCloudEssentialsSubscription_PaidCRUDI(t *testing.T) { subscriptionName := acctest.RandomWithPrefix(testResourcePrefix) subscriptionNameUpdated := subscriptionName + "-updated" - resourceName := "rediscloud_essentials_subscription.example" - datasourceName := "data.rediscloud_essentials_subscription.example" + const resourceName = "rediscloud_essentials_subscription.example" + const datasourceName = "data.rediscloud_essentials_subscription.example" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -89,7 +89,7 @@ func TestAccResourceRedisCloudEssentialsSubscription_PaidCRUDI(t *testing.T) { Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudPaidEssentialsSubscription, subscriptionName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test the resource resource.TestCheckResourceAttrSet(resourceName, "id"), resource.TestCheckResourceAttr(resourceName, "name", subscriptionName), @@ -109,7 +109,7 @@ func TestAccResourceRedisCloudEssentialsSubscription_PaidCRUDI(t *testing.T) { }, { Config: fmt.Sprintf(testAccResourceRedisCloudPaidEssentialsSubscription, subscriptionNameUpdated), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test the resource resource.TestCheckResourceAttrSet(resourceName, "id"), resource.TestCheckResourceAttr(resourceName, "name", subscriptionNameUpdated), diff --git a/provider/rediscloud_transit_gateway_attachment_test.go b/provider/rediscloud_transit_gateway_attachment_test.go index 97839e53..e0395589 100644 --- a/provider/rediscloud_transit_gateway_attachment_test.go +++ b/provider/rediscloud_transit_gateway_attachment_test.go @@ -16,8 +16,8 @@ func TestAccResourceRedisCloudTransitGatewayAttachment_Pro(t *testing.T) { testTgwId := os.Getenv("AWS_TEST_TGW_ID") baseName := acctest.RandomWithPrefix(testResourcePrefix) + "-pro-tgwa" - resourceName := "rediscloud_transit_gateway_attachment.test" - datasourceName := "data.rediscloud_transit_gateway.test" + const resourceName = "rediscloud_transit_gateway_attachment.test" + const datasourceName = "data.rediscloud_transit_gateway.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAwsPreExistingTgwCheck(t) }, @@ -26,7 +26,7 @@ func TestAccResourceRedisCloudTransitGatewayAttachment_Pro(t *testing.T) { Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudTransitGatewayPro, testCloudAccountName, baseName, testTgwId), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test the datasource before attachment resource.TestCheckResourceAttrSet(datasourceName, "id"), resource.TestCheckResourceAttr(datasourceName, "aws_tgw_uid", testTgwId), @@ -43,7 +43,7 @@ func TestAccResourceRedisCloudTransitGatewayAttachment_Pro(t *testing.T) { }, { Config: fmt.Sprintf(testAccResourceRedisCloudTransitGatewayAttachmentPro, testCloudAccountName, baseName, testTgwId), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Test the resource resource.TestCheckResourceAttrSet(resourceName, "id"), resource.TestCheckResourceAttr(resourceName, "aws_tgw_uid", testTgwId), diff --git a/provider/resource_rediscloud_active_active_subscription_peering_test.go b/provider/resource_rediscloud_active_active_subscription_peering_test.go index 5486e6eb..e4daf52b 100644 --- a/provider/resource_rediscloud_active_active_subscription_peering_test.go +++ b/provider/resource_rediscloud_active_active_subscription_peering_test.go @@ -43,7 +43,7 @@ func TestAccResourceRedisCloudActiveActiveSubscriptionPeering_aws(t *testing.T) vpcId, cidrRange, ) - resourceName := "rediscloud_active_active_subscription_peering.test" + const resourceName = "rediscloud_active_active_subscription_peering.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAwsPeeringPreCheck(t); testAccAwsPreExistingCloudAccountPreCheck(t) }, @@ -52,7 +52,7 @@ func TestAccResourceRedisCloudActiveActiveSubscriptionPeering_aws(t *testing.T) Steps: []resource.TestStep{ { Config: tf, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestMatchResourceAttr(resourceName, "id", regexp.MustCompile("^\\d*/\\d*$")), resource.TestCheckResourceAttrSet(resourceName, "status"), resource.TestCheckResourceAttrSet(resourceName, "provider_name"), @@ -79,7 +79,7 @@ func TestAccResourceRedisCloudActiveActiveSubscriptionPeering_gcp(t *testing.T) os.Getenv("GCP_VPC_PROJECT"), os.Getenv("GCP_VPC_ID"), ) - resourceName := "rediscloud_active_active_subscription_peering.test" + const resourceName = "rediscloud_active_active_subscription_peering.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -88,7 +88,7 @@ func TestAccResourceRedisCloudActiveActiveSubscriptionPeering_gcp(t *testing.T) Steps: []resource.TestStep{ { Config: tf, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestMatchResourceAttr(resourceName, "id", regexp.MustCompile("^\\d*/\\d*$")), resource.TestCheckResourceAttr(resourceName, "provider_name", "GCP"), resource.TestCheckResourceAttrSet(resourceName, "status"), diff --git a/provider/resource_rediscloud_active_active_subscription_regions_test.go b/provider/resource_rediscloud_active_active_subscription_regions_test.go index f0525bf5..02d9dd62 100644 --- a/provider/resource_rediscloud_active_active_subscription_regions_test.go +++ b/provider/resource_rediscloud_active_active_subscription_regions_test.go @@ -16,7 +16,7 @@ func TestAccResourceRedisCloudActiveActiveSubscriptionRegions_CRUDI(t *testing.T subName := acctest.RandomWithPrefix(testResourcePrefix) + "-regions-test" dbName := acctest.RandomWithPrefix(testResourcePrefix) + "-regions" + "-db" dbPass := acctest.RandString(20) - resourceName := "rediscloud_active_active_subscription_regions.example" + const resourceName = "rediscloud_active_active_subscription_regions.example" var subId int @@ -27,7 +27,7 @@ func TestAccResourceRedisCloudActiveActiveSubscriptionRegions_CRUDI(t *testing.T Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudCreateActiveActiveRegion, subName, dbName, dbPass), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "region.#", "3"), resource.TestCheckResourceAttr(resourceName, "region.2.region", "eu-west-2"), resource.TestCheckResourceAttr(resourceName, "region.2.networking_deployment_cidr", "10.2.0.0/24"), @@ -61,7 +61,7 @@ func TestAccResourceRedisCloudActiveActiveSubscriptionRegions_CRUDI(t *testing.T { // Checks region re-created correctly Config: fmt.Sprintf(testAccResourceRedisCloudReCreateActiveActiveRegion, subName, dbName, dbPass), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "region.#", "3"), resource.TestCheckResourceAttr(resourceName, "region.2.region", "eu-west-2"), resource.TestCheckResourceAttr(resourceName, "region.2.networking_deployment_cidr", "10.3.0.0/24"), @@ -74,7 +74,7 @@ func TestAccResourceRedisCloudActiveActiveSubscriptionRegions_CRUDI(t *testing.T { // Checks region DB updated correctly Config: fmt.Sprintf(testAccResourceRedisCloudUpdateDBActiveActiveRegion, subName, dbName, dbPass), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "region.#", "3"), resource.TestCheckResourceAttr(resourceName, "region.2.region", "eu-west-2"), resource.TestCheckResourceAttr(resourceName, "region.2.networking_deployment_cidr", "10.3.0.0/24"), @@ -87,7 +87,7 @@ func TestAccResourceRedisCloudActiveActiveSubscriptionRegions_CRUDI(t *testing.T { // Checks regions deleted (eu-west-2 and us-east-2) and created (eu-west-1) correctly Config: fmt.Sprintf(testAccResourceRedisCloudRemoveAndCreateSameTimeActiveActiveRegion, subName, dbName, dbPass), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "region.#", "2"), resource.TestCheckResourceAttr(resourceName, "region.0.region", "us-east-1"), resource.TestCheckResourceAttr(resourceName, "region.0.networking_deployment_cidr", "10.0.0.0/24"), diff --git a/provider/resource_rediscloud_cloud_account_test.go b/provider/resource_rediscloud_cloud_account_test.go index 0d9888df..f91b2fb8 100644 --- a/provider/resource_rediscloud_cloud_account_test.go +++ b/provider/resource_rediscloud_cloud_account_test.go @@ -29,7 +29,7 @@ func TestAccResourceRedisCloudCloudAccount_basic(t *testing.T) { name, os.Getenv("AWS_SIGNIN_URL"), ) - resourceName := "rediscloud_cloud_account.test" + const resourceName = "rediscloud_cloud_account.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAwsCloudAccountPreCheck(t) }, @@ -38,7 +38,7 @@ func TestAccResourceRedisCloudCloudAccount_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: tf, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestMatchResourceAttr( resourceName, "id", regexp.MustCompile("^\\d*$")), resource.TestCheckResourceAttr( diff --git a/provider/resource_rediscloud_pro_database_test.go b/provider/resource_rediscloud_pro_database_test.go index 594dc378..d98c0d40 100644 --- a/provider/resource_rediscloud_pro_database_test.go +++ b/provider/resource_rediscloud_pro_database_test.go @@ -19,9 +19,9 @@ func TestAccResourceRedisCloudProDatabase_CRUDI(t *testing.T) { name := acctest.RandomWithPrefix(testResourcePrefix) password := acctest.RandString(20) - resourceName := "rediscloud_subscription_database.example" - subscriptionResourceName := "rediscloud_subscription.example" - replicaResourceName := "rediscloud_subscription_database.example_replica" + const resourceName = "rediscloud_subscription_database.example" + const subscriptionResourceName = "rediscloud_subscription.example" + const replicaResourceName = "rediscloud_subscription_database.example_replica" testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") var subId int @@ -34,7 +34,7 @@ func TestAccResourceRedisCloudProDatabase_CRUDI(t *testing.T) { // Test database and replica database creation { Config: fmt.Sprintf(testAccResourceRedisCloudProDatabase, testCloudAccountName, name, password) + testAccResourceRedisCloudProDatabaseReplica, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", "example"), resource.TestCheckResourceAttr(resourceName, "protocol", "redis"), resource.TestCheckResourceAttr(resourceName, "memory_limit_in_gb", "3"), @@ -97,7 +97,7 @@ func TestAccResourceRedisCloudProDatabase_CRUDI(t *testing.T) { // Test database is updated successfully { Config: fmt.Sprintf(testAccResourceRedisCloudProDatabaseUpdate, testCloudAccountName, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", "example-updated"), resource.TestCheckResourceAttr(resourceName, "protocol", "redis"), resource.TestCheckResourceAttr(resourceName, "memory_limit_in_gb", "1"), @@ -124,14 +124,14 @@ func TestAccResourceRedisCloudProDatabase_CRUDI(t *testing.T) { // Test that alerts are deleted { Config: fmt.Sprintf(testAccResourceRedisCloudProDatabaseUpdateDestroyAlerts, testCloudAccountName, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "alert.#", "0"), ), }, // Test that a 32-character password is generated when no password is provided { Config: fmt.Sprintf(testAccResourceRedisCloudProDatabaseNoPassword, testCloudAccountName, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( func(s *terraform.State) error { is := s.RootModule().Resources["rediscloud_subscription_database.no_password_database"].Primary if len(is.Attributes["password"]) != 32 { @@ -154,7 +154,7 @@ func TestAccResourceRedisCloudProDatabase_CRUDI(t *testing.T) { func TestAccResourceRedisCloudProDatabase_optionalAttributes(t *testing.T) { // Test that attributes can be optional, either by setting them or not having them set when compared to CRUDI test name := acctest.RandomWithPrefix(testResourcePrefix) - resourceName := "rediscloud_subscription_database.example" + const resourceName = "rediscloud_subscription_database.example" testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") portNumber := 10101 @@ -165,7 +165,7 @@ func TestAccResourceRedisCloudProDatabase_optionalAttributes(t *testing.T) { Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudProDatabaseOptionalAttributes, testCloudAccountName, name, portNumber), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "protocol", "redis"), resource.TestCheckResourceAttr(resourceName, "port", strconv.Itoa(portNumber)), ), @@ -195,7 +195,7 @@ func TestAccResourceRedisCloudProDatabase_timeUtcRequiresValidInterval(t *testin func TestAccResourceRedisCloudProDatabase_MultiModules(t *testing.T) { name := acctest.RandomWithPrefix(testResourcePrefix) dbName := "db-multi-modules" - resourceName := "rediscloud_subscription_database.example" + const resourceName = "rediscloud_subscription_database.example" testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") resource.ParallelTest(t, resource.TestCase{ @@ -205,7 +205,7 @@ func TestAccResourceRedisCloudProDatabase_MultiModules(t *testing.T) { Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudProDatabaseMultiModules, testCloudAccountName, name, dbName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", dbName), resource.TestCheckResourceAttr(resourceName, "modules.#", "2"), resource.TestCheckResourceAttr(resourceName, "modules.0.name", "RedisBloom"), @@ -224,7 +224,7 @@ func TestAccResourceRedisCloudProDatabase_MultiModules(t *testing.T) { func TestAccResourceRedisCloudProDatabase_respversion(t *testing.T) { // Test that attributes can be optional, either by setting them or not having them set when compared to CRUDI test name := acctest.RandomWithPrefix(testResourcePrefix) - resourceName := "rediscloud_subscription_database.example" + const resourceName = "rediscloud_subscription_database.example" testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") portNumber := 10101 @@ -235,13 +235,13 @@ func TestAccResourceRedisCloudProDatabase_respversion(t *testing.T) { Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudProDatabaseRespVersions, testCloudAccountName, name, portNumber, "resp2"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "resp_version", "resp2"), ), }, { Config: fmt.Sprintf(testAccResourceRedisCloudProDatabaseRespVersions, testCloudAccountName, name, portNumber, "resp3"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "resp_version", "resp3"), ), }, diff --git a/provider/resource_rediscloud_pro_subscription_test.go b/provider/resource_rediscloud_pro_subscription_test.go index 38f7f03d..628ae78f 100644 --- a/provider/resource_rediscloud_pro_subscription_test.go +++ b/provider/resource_rediscloud_pro_subscription_test.go @@ -28,7 +28,7 @@ var marketplaceFlag = flag.Bool("marketplace", false, func TestAccResourceRedisCloudProSubscription_CRUDI(t *testing.T) { name := acctest.RandomWithPrefix(testResourcePrefix) - resourceName := "rediscloud_subscription.example" + const resourceName = "rediscloud_subscription.example" testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") var subId int @@ -40,7 +40,7 @@ func TestAccResourceRedisCloudProSubscription_CRUDI(t *testing.T) { Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudProSubscription, testCloudAccountName, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttr(resourceName, "payment_method", "credit-card"), resource.TestCheckResourceAttr(resourceName, "cloud_provider.0.provider", "AWS"), @@ -85,7 +85,7 @@ func TestAccResourceRedisCloudProSubscription_CRUDI(t *testing.T) { { // Checks if the changes in the creation plan are ignored. Config: fmt.Sprintf(testAccResourceRedisCloudProSubscriptionNoCreationPlan, testCloudAccountName, name, "ram"), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "creation_plan.#", "1"), resource.TestCheckResourceAttr(resourceName, "creation_plan.0.average_item_size_in_bytes", "0"), resource.TestCheckResourceAttr(resourceName, "creation_plan.0.memory_limit_in_gb", "1"), @@ -99,7 +99,7 @@ func TestAccResourceRedisCloudProSubscription_CRUDI(t *testing.T) { { // Checks if the changes to the payment_method are ignored. Config: fmt.Sprintf(testAccResourceRedisCloudSubscriptionChangedPaymentMethod, testCloudAccountName, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "payment_method", "credit-card"), ), }, @@ -131,7 +131,7 @@ func TestAccResourceRedisCloudProSubscription_CRUDI(t *testing.T) { func TestAccResourceRedisCloudProSubscription_preferredAZsModulesOptional(t *testing.T) { name := acctest.RandomWithPrefix(testResourcePrefix) - resourceName := "rediscloud_subscription.example" + const resourceName = "rediscloud_subscription.example" testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") resource.ParallelTest(t, resource.TestCase{ @@ -141,7 +141,7 @@ func TestAccResourceRedisCloudProSubscription_preferredAZsModulesOptional(t *tes Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudProSubscriptionPreferredAZsModulesOptional, testCloudAccountName, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttr(resourceName, "cloud_provider.0.region.0.preferred_availability_zones.#", "1"), ), @@ -158,7 +158,7 @@ func TestAccResourceRedisCloudProSubscription_createUpdateContractPayment(t *tes name := acctest.RandomWithPrefix(testResourcePrefix) updatedName := fmt.Sprintf("%v-updatedName", name) - resourceName := "rediscloud_subscription.example" + const resourceName = "rediscloud_subscription.example" testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") resource.ParallelTest(t, resource.TestCase{ @@ -168,7 +168,7 @@ func TestAccResourceRedisCloudProSubscription_createUpdateContractPayment(t *tes Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudProSubscriptionContractPayment, testCloudAccountName, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttr(resourceName, "cloud_provider.0.provider", "AWS"), resource.TestCheckResourceAttr(resourceName, "cloud_provider.0.region.0.preferred_availability_zones.#", "1"), @@ -178,7 +178,7 @@ func TestAccResourceRedisCloudProSubscription_createUpdateContractPayment(t *tes }, { Config: fmt.Sprintf(testAccResourceRedisCloudProSubscriptionContractPayment, testCloudAccountName, updatedName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttrSet(resourceName, "payment_method_id"), resource.TestCheckResourceAttr(resourceName, "name", updatedName), ), @@ -195,7 +195,7 @@ func TestAccResourceRedisCloudProSubscription_createUpdateMarketplacePayment(t * name := acctest.RandomWithPrefix(testResourcePrefix) updatedName := fmt.Sprintf("%v-updatedName", name) - resourceName := "rediscloud_subscription.example" + const resourceName = "rediscloud_subscription.example" testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") resource.ParallelTest(t, resource.TestCase{ @@ -205,7 +205,7 @@ func TestAccResourceRedisCloudProSubscription_createUpdateMarketplacePayment(t * Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudSubscriptionMarketplacePayment, testCloudAccountName, name), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttr(resourceName, "cloud_provider.0.provider", "AWS"), resource.TestCheckResourceAttr(resourceName, "cloud_provider.0.region.0.preferred_availability_zones.#", "1"), @@ -214,7 +214,7 @@ func TestAccResourceRedisCloudProSubscription_createUpdateMarketplacePayment(t * }, { Config: fmt.Sprintf(testAccResourceRedisCloudSubscriptionMarketplacePayment, testCloudAccountName, updatedName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", updatedName), ), }, @@ -252,7 +252,7 @@ func TestAccResourceRedisCloudProSubscription_RedisVersion(t *testing.T) { Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudProSubscriptionWithRedisVersion, testCloudAccountName, name, ""), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Take a snapshot of the ID func(s *terraform.State) error { r := s.RootModule().Resources["rediscloud_subscription.test"] @@ -263,7 +263,7 @@ func TestAccResourceRedisCloudProSubscription_RedisVersion(t *testing.T) { }, { Config: fmt.Sprintf(testAccResourceRedisCloudProSubscriptionWithRedisVersion, testCloudAccountName, name, "redis_version = \"latest\""), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( // Take a snapshot of the ID func(s *terraform.State) error { r := s.RootModule().Resources["rediscloud_subscription.test"] @@ -336,7 +336,7 @@ func TestAccResourceRedisCloudProSubscription_MaintenanceWindows(t *testing.T) { Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudProSubscriptionMaintenanceWindows, testCloudAccountName, name, defaultMW), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttr(resourceName, "maintenance_windows.0.mode", "automatic"), resource.TestCheckResourceAttr(resourceName, "maintenance_windows.0.window.#", "0"), @@ -348,7 +348,7 @@ func TestAccResourceRedisCloudProSubscription_MaintenanceWindows(t *testing.T) { }, { Config: fmt.Sprintf(testAccResourceRedisCloudProSubscriptionMaintenanceWindows, testCloudAccountName, name, autoMw), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "maintenance_windows.0.mode", "automatic"), resource.TestCheckResourceAttr(resourceName, "maintenance_windows.0.window.#", "0"), @@ -358,7 +358,7 @@ func TestAccResourceRedisCloudProSubscription_MaintenanceWindows(t *testing.T) { }, { Config: fmt.Sprintf(testAccResourceRedisCloudProSubscriptionMaintenanceWindows, testCloudAccountName, name, manualMw), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "maintenance_windows.0.mode", "manual"), resource.TestCheckResourceAttr(resourceName, "maintenance_windows.0.window.#", "1"), resource.TestCheckResourceAttr(resourceName, "maintenance_windows.0.window.0.start_hour", "22"), @@ -386,7 +386,7 @@ func TestAccResourceRedisCloudProSubscription_MaintenanceWindows(t *testing.T) { }, { Config: fmt.Sprintf(testAccResourceRedisCloudProSubscriptionMaintenanceWindows, testCloudAccountName, name, multipleManualMw), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "maintenance_windows.0.mode", "manual"), resource.TestCheckResourceAttr(resourceName, "maintenance_windows.0.window.#", "2"), @@ -422,7 +422,7 @@ func TestAccResourceRedisCloudProSubscription_MaintenanceWindows(t *testing.T) { }, { Config: fmt.Sprintf(testAccResourceRedisCloudProSubscriptionMaintenanceWindows, testCloudAccountName, name, autoMw), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(resourceName, "maintenance_windows.0.mode", "automatic"), resource.TestCheckResourceAttr(resourceName, "maintenance_windows.0.window.#", "0"), diff --git a/provider/resource_rediscloud_pro_tls_test.go b/provider/resource_rediscloud_pro_tls_test.go index 256ceadc..47b9168f 100644 --- a/provider/resource_rediscloud_pro_tls_test.go +++ b/provider/resource_rediscloud_pro_tls_test.go @@ -22,8 +22,8 @@ func TestAccResourceRedisCloudSubscription_createWithDatabaseWithEnabledTlsAndSs name := acctest.RandomWithPrefix(testResourcePrefix) password := acctest.RandString(20) - subscriptionName := "rediscloud_subscription.example" - databaseName := "rediscloud_subscription_database.example" + const subscriptionName = "rediscloud_subscription.example" + const databaseName = "rediscloud_subscription_database.example" testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") var subId int @@ -38,7 +38,7 @@ func TestAccResourceRedisCloudSubscription_createWithDatabaseWithEnabledTlsAndSs Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudSubscriptionOneDbWithEnableTlsAndCert, testCloudAccountName, name, 1, password, sslCertificate), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(subscriptionName, "name", name), resource.TestCheckResourceAttr(subscriptionName, "cloud_provider.0.provider", "AWS"), resource.TestCheckResourceAttr(subscriptionName, "cloud_provider.0.region.0.preferred_availability_zones.#", "1"), @@ -87,7 +87,7 @@ func TestAccResourceRedisCloudSubscription_createWithDatabaseWithEnabledTlsAndSs // Ensure that SSL users can upgrade to TLS { Config: fmt.Sprintf(testAccResourceRedisCloudSubscriptionOneDbWithEnableTlsAndTlsCert, testCloudAccountName, name, 1, password, sslCertificate), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(subscriptionName, "name", name), resource.TestCheckResourceAttr(subscriptionName, "cloud_provider.0.provider", "AWS"), resource.TestCheckResourceAttr(subscriptionName, "cloud_provider.0.region.0.preferred_availability_zones.#", "1"), @@ -101,7 +101,7 @@ func TestAccResourceRedisCloudSubscription_createWithDatabaseWithEnabledTlsAndSs // And that mTLS can be switched off altogether { Config: fmt.Sprintf(testAccResourceRedisCloudSubscriptionOneDbWithEnableTlsAndNoCert, testCloudAccountName, name, 1, password), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(subscriptionName, "name", name), resource.TestCheckResourceAttr(subscriptionName, "cloud_provider.0.provider", "AWS"), resource.TestCheckResourceAttr(subscriptionName, "cloud_provider.0.region.0.preferred_availability_zones.#", "1"), @@ -127,8 +127,8 @@ func TestAccResourceRedisCloudSubscription_createWithDatabaseWithEnabledTlsAndEm name := acctest.RandomWithPrefix(testResourcePrefix) password := acctest.RandString(20) - subscriptionName := "rediscloud_subscription.example" - databaseName := "rediscloud_subscription_database.example" + const subscriptionName = "rediscloud_subscription.example" + const databaseName = "rediscloud_subscription_database.example" testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") var subId int @@ -140,7 +140,7 @@ func TestAccResourceRedisCloudSubscription_createWithDatabaseWithEnabledTlsAndEm Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudSubscriptionOneDbWithEnableTlsAndWithoutCert, testCloudAccountName, name, 1, password), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(subscriptionName, "name", name), resource.TestCheckResourceAttr(subscriptionName, "cloud_provider.0.provider", "AWS"), resource.TestCheckResourceAttr(subscriptionName, "cloud_provider.0.region.0.preferred_availability_zones.#", "1"), @@ -295,8 +295,8 @@ func TestAccResourceRedisCloudSubscription_createWithDatabaseWithEnabledTlsAndTl name := acctest.RandomWithPrefix(testResourcePrefix) password := acctest.RandString(20) - subscriptionName := "rediscloud_subscription.example" - databaseName := "rediscloud_subscription_database.example" + const subscriptionName = "rediscloud_subscription.example" + const databaseName = "rediscloud_subscription_database.example" testCloudAccountName := os.Getenv("AWS_TEST_CLOUD_ACCOUNT_NAME") var subId int @@ -311,7 +311,7 @@ func TestAccResourceRedisCloudSubscription_createWithDatabaseWithEnabledTlsAndTl Steps: []resource.TestStep{ { Config: fmt.Sprintf(testAccResourceRedisCloudSubscriptionOneDbWithEnableTlsAndTlsCert, testCloudAccountName, name, 1, password, sslCertificate), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr(subscriptionName, "name", name), resource.TestCheckResourceAttr(subscriptionName, "cloud_provider.0.provider", "AWS"), resource.TestCheckResourceAttr(subscriptionName, "cloud_provider.0.region.0.preferred_availability_zones.#", "1"), diff --git a/provider/resource_rediscloud_subscription_peering_test.go b/provider/resource_rediscloud_subscription_peering_test.go index 42488816..12dbed12 100644 --- a/provider/resource_rediscloud_subscription_peering_test.go +++ b/provider/resource_rediscloud_subscription_peering_test.go @@ -47,7 +47,7 @@ func TestAccResourceRedisCloudSubscriptionPeering_aws(t *testing.T) { vpcId, cidrRange, ) - resourceName := "rediscloud_subscription_peering.test" + const resourceName = "rediscloud_subscription_peering.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAwsPeeringPreCheck(t); testAccAwsPreExistingCloudAccountPreCheck(t) }, @@ -56,7 +56,7 @@ func TestAccResourceRedisCloudSubscriptionPeering_aws(t *testing.T) { Steps: []resource.TestStep{ { Config: tf, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestMatchResourceAttr(resourceName, "id", regexp.MustCompile("^\\d*/\\d*$")), resource.TestCheckResourceAttrSet(resourceName, "status"), resource.TestCheckResourceAttrSet(resourceName, "provider_name"), @@ -82,7 +82,7 @@ func TestAccResourceRedisCloudSubscriptionPeering_gcp(t *testing.T) { os.Getenv("GCP_VPC_PROJECT"), os.Getenv("GCP_VPC_ID"), ) - resourceName := "rediscloud_subscription_peering.test" + const resourceName = "rediscloud_subscription_peering.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -91,7 +91,7 @@ func TestAccResourceRedisCloudSubscriptionPeering_gcp(t *testing.T) { Steps: []resource.TestStep{ { Config: tf, - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( resource.TestMatchResourceAttr(resourceName, "id", regexp.MustCompile("^\\d*/\\d*$")), resource.TestCheckResourceAttr(resourceName, "provider_name", "GCP"), resource.TestCheckResourceAttrSet(resourceName, "status"),