Skip to content

Commit f3e1194

Browse files
committed
Reverted and refactored some acceptance tests
1 parent 8348b00 commit f3e1194

File tree

2 files changed

+22
-27
lines changed

2 files changed

+22
-27
lines changed

internal/provider/resource_gitlab_group_share_group_test.go

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,21 @@ func TestAccGitlabGroupShareGroup_basic(t *testing.T) {
4747
ImportState: true,
4848
ImportStateVerify: true,
4949
},
50-
// Delete the gitlab_group_share_group resource
50+
// Update share group back to initial settings
5151
{
52-
Config: testAccGitlabGroupShareGroupConfigDelete(),
53-
Check: testAccCheckGitlabGroupIsNotShared(mainGroup.Name),
52+
Config: testAccGitlabGroupShareGroupConfig(mainGroup.ID, sharedGroup.ID,
53+
`
54+
group_access = "guest"
55+
expires_at = "2099-01-01"
56+
`,
57+
),
58+
Check: testAccCheckGitlabGroupSharedWithGroup(mainGroup.Name, sharedGroup.Name, "2099-01-01", gitlab.GuestPermissions),
59+
},
60+
{
61+
// Verify Import
62+
ResourceName: "gitlab_group_share_group.test",
63+
ImportState: true,
64+
ImportStateVerify: true,
5465
},
5566
},
5667
})
@@ -88,22 +99,6 @@ func testAccCheckGitlabGroupSharedWithGroup(mainGroupName string, sharedGroupNam
8899
}
89100
}
90101

91-
func testAccCheckGitlabGroupIsNotShared(mainGroupName string) resource.TestCheckFunc {
92-
return func(_ *terraform.State) error {
93-
mainGroup, _, err := testGitlabClient.Groups.GetGroup(mainGroupName, nil)
94-
if err != nil {
95-
return err
96-
}
97-
98-
sharedGroupsCount := len(mainGroup.SharedWithGroups)
99-
if sharedGroupsCount != 0 {
100-
return fmt.Errorf("Number of shared groups was %d (wanted %d)", sharedGroupsCount, 0)
101-
}
102-
103-
return nil
104-
}
105-
}
106-
107102
func testAccCheckGitlabShareGroupDestroy(s *terraform.State) error {
108103
var groupId string
109104
var sharedGroupId int
@@ -148,7 +143,3 @@ func testAccGitlabGroupShareGroupConfig(mainGroupId int, shareGroupId int, share
148143
shareGroupSettings,
149144
)
150145
}
151-
152-
func testAccGitlabGroupShareGroupConfigDelete() string {
153-
return ``
154-
}

internal/provider/resource_gitlab_project_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,8 @@ func TestAccGitlabProject_willErrorOnAPIFailure(t *testing.T) {
662662
})
663663
}
664664

665-
func TestAccGitlabProject_imprt(t *testing.T) {
665+
// lintignore: AT002 // specialized import test
666+
func TestAccGitlabProject_import(t *testing.T) {
666667
rInt := acctest.RandInt()
667668
resource.Test(t, resource.TestCase{
668669
PreCheck: func() { testAccPreCheck(t) },
@@ -686,7 +687,8 @@ func TestAccGitlabProject_imprt(t *testing.T) {
686687
})
687688
}
688689

689-
func TestAccGitlabProject_nestedImprt(t *testing.T) {
690+
// lintignore: AT002 // specialized import test
691+
func TestAccGitlabProject_nestedImport(t *testing.T) {
690692
rInt := acctest.RandInt()
691693
resource.Test(t, resource.TestCase{
692694
PreCheck: func() { testAccPreCheck(t) },
@@ -766,7 +768,8 @@ func TestAccGitlabProject_transfer(t *testing.T) {
766768
})
767769
}
768770

769-
func TestAccGitlabProject_imprtURL(t *testing.T) {
771+
// lintignore: AT002 // not a Terraform import test
772+
func TestAccGitlabProject_importURL(t *testing.T) {
770773
testAccCheck(t)
771774

772775
rInt := acctest.RandInt()
@@ -890,7 +893,8 @@ func testAccCheckGitlabProjectMirroredAttributes(project *gitlab.Project, want *
890893
}
891894
}
892895

893-
func TestAccGitlabProject_ImprtURLMirrored(t *testing.T) {
896+
// lintignore: AT002 // not a Terraform import test
897+
func TestAccGitlabProject_ImportURLMirrored(t *testing.T) {
894898
testAccCheck(t)
895899

896900
var mirror gitlab.Project

0 commit comments

Comments
 (0)