Skip to content

Commit 6315964

Browse files
author
Edgar López
committed
test: changed database user to create project and get it, changed import to rs primare attributes instead of decode state id
1 parent 42fc7f3 commit 6315964

8 files changed

+138
-91
lines changed

mongodbatlas/resource_mongodbatlas_alert_configuration_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,7 @@ func testAccCheckMongoDBAtlasAlertConfigurationImportStateIDFunc(resourceName st
276276
return "", fmt.Errorf("not found: %s", resourceName)
277277
}
278278

279-
ids := decodeStateID(rs.Primary.ID)
280-
281-
return fmt.Sprintf("%s-%s", ids["project_id"], ids["id"]), nil
279+
return fmt.Sprintf("%s-%s", rs.Primary.Attributes["project_id"], rs.Primary.Attributes["alert_configuration_id"]), nil
282280
}
283281
}
284282

mongodbatlas/resource_mongodbatlas_cloud_provider_snapshot_restore_job_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,7 @@ func testAccCheckMongoDBAtlasCloudProviderSnapshotRestoreJobImportStateIDFunc(re
180180
return "", fmt.Errorf("not found:: %s", resourceName)
181181
}
182182

183-
ids := decodeStateID(rs.Primary.ID)
184-
185-
return fmt.Sprintf("%s-%s-%s", ids["project_id"], ids["cluster_name"], ids["snapshot_restore_job_id"]), nil
183+
return fmt.Sprintf("%s-%s-%s", rs.Primary.Attributes["project_id"], rs.Primary.Attributes["cluster_name"], rs.Primary.Attributes["snapshot_restore_job_id"]), nil
186184
}
187185
}
188186

mongodbatlas/resource_mongodbatlas_cloud_provider_snapshot_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,7 @@ func testAccCheckMongoDBAtlasCloudProviderSnapshotImportStateIDFunc(resourceName
148148
return "", fmt.Errorf("not found: %s", resourceName)
149149
}
150150

151-
ids := decodeStateID(rs.Primary.ID)
152-
153-
log.Printf("%s-%s-%s", ids["project_id"], ids["cluster_name"], ids["snapshot_id"])
154-
155-
return fmt.Sprintf("%s-%s-%s", ids["project_id"], ids["cluster_name"], ids["snapshot_id"]), nil
151+
return fmt.Sprintf("%s-%s-%s", rs.Primary.Attributes["project_id"], rs.Primary.Attributes["cluster_name"], rs.Primary.Attributes["snapshot_id"]), nil
156152
}
157153
}
158154

mongodbatlas/resource_mongodbatlas_cluster_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -855,9 +855,7 @@ func testAccCheckMongoDBAtlasClusterImportStateIDFunc(resourceName string) resou
855855
return "", fmt.Errorf("not found: %s", resourceName)
856856
}
857857

858-
ids := decodeStateID(rs.Primary.ID)
859-
860-
return fmt.Sprintf("%s-%s", ids["project_id"], ids["cluster_name"]), nil
858+
return fmt.Sprintf("%s-%s", rs.Primary.Attributes["project_id"], rs.Primary.Attributes["name"]), nil
861859
}
862860
}
863861

mongodbatlas/resource_mongodbatlas_custom_db_role_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -663,9 +663,7 @@ func testAccCheckMongoDBAtlasCustomDBRolesImportStateIDFunc(resourceName string)
663663
return "", fmt.Errorf("not found: %s", resourceName)
664664
}
665665

666-
ids := decodeStateID(rs.Primary.ID)
667-
668-
return fmt.Sprintf("%s-%s", ids["project_id"], ids["role_name"]), nil
666+
return fmt.Sprintf("%s-%s", rs.Primary.Attributes["project_id"], rs.Primary.Attributes["role_name"]), nil
669667
}
670668
}
671669

0 commit comments

Comments
 (0)