mongodb / terraform-provider-mongodbatlas

Terraform MongoDB Atlas Provider: Deploy, update, and manage MongoDB Atlas infrastructure as code through HashiCorp Terraform
https://registry.terraform.io/providers/mongodb/mongodbatlas
Mozilla Public License 2.0
230 stars 167 forks source link

test: Refactors `mongodb_advanced_cluster` tests #2361

Closed lantoli closed 6 days ago

lantoli commented 1 week ago

Description

Refactors mongodb_advanced_cluster tests.

Also adding aggregate checks (soft assertions) as in CLOUDP-256881 so no need to run mongodb_advanced_cluster tests again in another PR.

(although it was not the goal, the file has now 100 fewer lines)

Link to any related issue(s): CLOUDP-256561

Type of change:

Required Checklist:

Further comments

Example of aggregate check fails:

=== CONT  TestAccClusterAdvancedCluster_basicTenant
    resource_advanced_cluster_test.go:29: Step 1/3 error: Check failed: Check 3/20 error: mongodbatlas_advanced_cluster.test: Attribute 'global_cluster_self_managed_sharding' expected "false678", got "false"
        Check 5/20 error: mongodbatlas_advanced_cluster.test: Attribute 'name' expected "test-acc-tf-c-793928882496728491490", got "test-acc-tf-c-7939288824967284914"
        Check 7/20 error: data.mongodbatlas_advanced_cluster.test: Attribute 'name' expected "test-acc-tf-c-793928882496728491490", got "test-acc-tf-c-7939288824967284914"
        Check 9/20 error: data.mongodbatlas_advanced_cluster.test: Attribute 'global_cluster_self_managed_sharding' expected "false678", got "false"
        Check 10/20 error: mongodbatlas_advanced_cluster.test: Attribute 'project_id123' expected to be set
        Check 12/20 error: mongodbatlas_advanced_cluster.test: Attribute 'replication_specs.0.region_configs456.#' expected to be set
        Check 13/20 error: data.mongodbatlas_advanced_cluster.test: Attribute 'project_id123' expected to be set
        Check 15/20 error: data.mongodbatlas_advanced_cluster.test: Attribute 'replication_specs.0.region_configs456.#' expected to be set
--- FAIL: TestAccClusterAdvancedCluster_basicTenant (248.79s)