From 43aae57b1a3f9420183b3b1be62c83ada5d3e98a Mon Sep 17 00:00:00 2001 From: Leo Antoli <430982+lantoli@users.noreply.github.com> Date: Tue, 28 Nov 2023 18:50:31 +0100 Subject: [PATCH] try 2 tests --- .../project/data_source_projects_test.go | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/internal/service/project/data_source_projects_test.go b/internal/service/project/data_source_projects_test.go index 14ddab4807..631ee8b89c 100644 --- a/internal/service/project/data_source_projects_test.go +++ b/internal/service/project/data_source_projects_test.go @@ -51,6 +51,45 @@ func TestAccProjectDSProjects_basic(t *testing.T) { }) } +func TestAccProjectDSProjects_basic2(t *testing.T) { + var ( + projectName = fmt.Sprintf("test-datasource-project-%s", acctest.RandString(10)) + orgID = os.Getenv("MONGODB_ATLAS_ORG_ID") + ) + resource.Test(t, resource.TestCase{ + PreCheck: func() { + acc.DebugVersion(t, "TestAccProjectDSProjects_basic2", projectName) + acc.PreCheckBasic(t) + acc.PreCheckProjectTeamsIds(t, 2) + }, + ProtoV6ProviderFactories: acc.TestAccProviderV6Factories, + Steps: []resource.TestStep{ + { + Config: testAccMongoDBAtlasProjectsConfigWithDS(t, projectName, orgID, + []*matlas.ProjectTeam{ + { + TeamID: acc.GetProjectTeamsIds(0), + RoleNames: []string{"GROUP_READ_ONLY", "GROUP_DATA_ACCESS_ADMIN"}, + }, + { + TeamID: acc.GetProjectTeamsIds(1), + RoleNames: []string{"GROUP_DATA_ACCESS_ADMIN", "GROUP_OWNER"}, + }, + }, + ), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("mongodbatlas_project.test", "name"), + resource.TestCheckResourceAttrSet("mongodbatlas_project.test", "org_id"), + resource.TestCheckResourceAttr("mongodbatlas_project.test", "teams.#", "2"), + // Test for Data source + resource.TestCheckResourceAttrSet("data.mongodbatlas_projects.test", "total_count"), + resource.TestCheckResourceAttrSet("data.mongodbatlas_projects.test", "results.#"), + ), + }, + }, + }) +} + func TestAccProjectDSProjects_withPagination(t *testing.T) { var ( projectName = fmt.Sprintf("test-datasource-project-%s", acctest.RandString(10))