@@ -26,10 +26,14 @@ func TestAccGitlabGroup_basic(t *testing.T) {
2626 Check : resource .ComposeTestCheckFunc (
2727 testAccCheckGitlabGroupExists ("gitlab_group.foo" , & group ),
2828 testAccCheckGitlabGroupAttributes (& group , & testAccGitlabGroupExpectedAttributes {
29- Name : fmt .Sprintf ("foo-name-%d" , rInt ),
30- Path : fmt .Sprintf ("foo-path-%d" , rInt ),
31- Description : "Terraform acceptance tests" ,
32- LFSEnabled : true ,
29+ Name : fmt .Sprintf ("foo-name-%d" , rInt ),
30+ Path : fmt .Sprintf ("foo-path-%d" , rInt ),
31+ Description : "Terraform acceptance tests" ,
32+ LFSEnabled : true ,
33+ Visibility : "public" , // default value
34+ ProjectCreationLevel : "maintainer" , // default value
35+ SubGroupCreationLevel : "owner" , // default value
36+ TwoFactorGracePeriod : 48 , // default value
3337 }),
3438 ),
3539 },
@@ -39,23 +43,37 @@ func TestAccGitlabGroup_basic(t *testing.T) {
3943 Check : resource .ComposeTestCheckFunc (
4044 testAccCheckGitlabGroupExists ("gitlab_group.foo" , & group ),
4145 testAccCheckGitlabGroupAttributes (& group , & testAccGitlabGroupExpectedAttributes {
42- Name : fmt .Sprintf ("bar-name-%d" , rInt ),
43- Path : fmt .Sprintf ("bar-path-%d" , rInt ),
44- Description : "Terraform acceptance tests! Updated description" ,
45- RequestAccessEnabled : true ,
46+ Name : fmt .Sprintf ("bar-name-%d" , rInt ),
47+ Path : fmt .Sprintf ("bar-path-%d" , rInt ),
48+ Description : "Terraform acceptance tests! Updated description" ,
49+ LFSEnabled : false ,
50+ Visibility : "public" , // default value
51+ RequestAccessEnabled : true ,
52+ ProjectCreationLevel : "developer" ,
53+ SubGroupCreationLevel : "maintainer" ,
54+ RequireTwoFactorAuth : true ,
55+ TwoFactorGracePeriod : 56 ,
56+ AutoDevopsEnabled : true ,
57+ EmailsDisabled : true ,
58+ MentionsDisabled : true ,
59+ ShareWithGroupLock : true ,
4660 }),
4761 ),
4862 },
49- // Update the group to put the anem and description back
63+ // Update the group to put the name and description back
5064 {
5165 Config : testAccGitlabGroupConfig (rInt ),
5266 Check : resource .ComposeTestCheckFunc (
5367 testAccCheckGitlabGroupExists ("gitlab_group.foo" , & group ),
5468 testAccCheckGitlabGroupAttributes (& group , & testAccGitlabGroupExpectedAttributes {
55- Name : fmt .Sprintf ("foo-name-%d" , rInt ),
56- Path : fmt .Sprintf ("foo-path-%d" , rInt ),
57- Description : "Terraform acceptance tests" ,
58- LFSEnabled : true ,
69+ Name : fmt .Sprintf ("foo-name-%d" , rInt ),
70+ Path : fmt .Sprintf ("foo-path-%d" , rInt ),
71+ Description : "Terraform acceptance tests" ,
72+ LFSEnabled : true ,
73+ Visibility : "public" , // default value
74+ ProjectCreationLevel : "maintainer" , // default value
75+ SubGroupCreationLevel : "owner" , // default value
76+ TwoFactorGracePeriod : 48 , // default value
5977 }),
6078 ),
6179 },
@@ -101,11 +119,15 @@ func TestAccGitlabGroup_nested(t *testing.T) {
101119 testAccCheckGitlabGroupExists ("gitlab_group.foo2" , & group2 ),
102120 testAccCheckGitlabGroupExists ("gitlab_group.nested_foo" , & nestedGroup ),
103121 testAccCheckGitlabGroupAttributes (& nestedGroup , & testAccGitlabGroupExpectedAttributes {
104- Name : fmt .Sprintf ("nfoo-name-%d" , rInt ),
105- Path : fmt .Sprintf ("nfoo-path-%d" , rInt ),
106- Description : "Terraform acceptance tests" ,
107- LFSEnabled : true ,
108- Parent : & group ,
122+ Name : fmt .Sprintf ("nfoo-name-%d" , rInt ),
123+ Path : fmt .Sprintf ("nfoo-path-%d" , rInt ),
124+ Description : "Terraform acceptance tests" ,
125+ LFSEnabled : true ,
126+ Visibility : "public" , // default value
127+ ProjectCreationLevel : "maintainer" , // default value
128+ SubGroupCreationLevel : "owner" , // default value
129+ TwoFactorGracePeriod : 48 , // default value
130+ Parent : & group ,
109131 }),
110132 ),
111133 },
@@ -116,11 +138,15 @@ func TestAccGitlabGroup_nested(t *testing.T) {
116138 testAccCheckGitlabGroupExists ("gitlab_group.foo2" , & group2 ),
117139 testAccCheckGitlabGroupExists ("gitlab_group.nested_foo" , & nestedGroup ),
118140 testAccCheckGitlabGroupAttributes (& nestedGroup , & testAccGitlabGroupExpectedAttributes {
119- Name : fmt .Sprintf ("nfoo-name-%d" , rInt ),
120- Path : fmt .Sprintf ("nfoo-path-%d" , rInt ),
121- Description : "Terraform acceptance tests - new parent" ,
122- LFSEnabled : true ,
123- Parent : & group2 ,
141+ Name : fmt .Sprintf ("nfoo-name-%d" , rInt ),
142+ Path : fmt .Sprintf ("nfoo-path-%d" , rInt ),
143+ Description : "Terraform acceptance tests - new parent" ,
144+ LFSEnabled : true ,
145+ Visibility : "public" , // default value
146+ ProjectCreationLevel : "maintainer" , // default value
147+ SubGroupCreationLevel : "owner" , // default value
148+ TwoFactorGracePeriod : 48 , // default value
149+ Parent : & group2 ,
124150 }),
125151 ),
126152 },
@@ -131,10 +157,14 @@ func TestAccGitlabGroup_nested(t *testing.T) {
131157 testAccCheckGitlabGroupExists ("gitlab_group.foo2" , & group2 ),
132158 testAccCheckGitlabGroupExists ("gitlab_group.nested_foo" , & nestedGroup ),
133159 testAccCheckGitlabGroupAttributes (& nestedGroup , & testAccGitlabGroupExpectedAttributes {
134- Name : fmt .Sprintf ("nfoo-name-%d" , rInt ),
135- Path : fmt .Sprintf ("nfoo-path-%d" , rInt ),
136- Description : "Terraform acceptance tests - updated" ,
137- LFSEnabled : true ,
160+ Name : fmt .Sprintf ("nfoo-name-%d" , rInt ),
161+ Path : fmt .Sprintf ("nfoo-path-%d" , rInt ),
162+ Description : "Terraform acceptance tests - updated" ,
163+ LFSEnabled : true ,
164+ Visibility : "public" , // default value
165+ ProjectCreationLevel : "maintainer" , // default value
166+ SubGroupCreationLevel : "owner" , // default value
167+ TwoFactorGracePeriod : 48 , // default value
138168 }),
139169 ),
140170 },
@@ -150,6 +180,10 @@ func TestAccGitlabGroup_nested(t *testing.T) {
150180 // Path: fmt.Sprintf("nfoo-path-%d", rInt),
151181 // Description: "Terraform acceptance tests",
152182 // LFSEnabled: true,
183+ // Visibility: "public", // default value
184+ // ProjectCreationLevel: "maintainer", // default value
185+ // SubGroupCreationLevel: "owner", // default value
186+ // TwoFactorGracePeriod: 48, // default value
153187 // Parent: &group,
154188 // }),
155189 // ),
@@ -228,12 +262,21 @@ func testAccCheckGitlabGroupExists(n string, group *gitlab.Group) resource.TestC
228262}
229263
230264type testAccGitlabGroupExpectedAttributes struct {
231- Name string
232- Path string
233- Description string
234- Parent * gitlab.Group
235- LFSEnabled bool
236- RequestAccessEnabled bool
265+ Name string
266+ Path string
267+ Description string
268+ Parent * gitlab.Group
269+ LFSEnabled bool
270+ RequestAccessEnabled bool
271+ Visibility gitlab.VisibilityValue
272+ ShareWithGroupLock bool
273+ AutoDevopsEnabled bool
274+ EmailsDisabled bool
275+ MentionsDisabled bool
276+ ProjectCreationLevel gitlab.ProjectCreationLevelValue
277+ SubGroupCreationLevel gitlab.SubGroupCreationLevelValue
278+ RequireTwoFactorAuth bool
279+ TwoFactorGracePeriod int
237280}
238281
239282func testAccCheckGitlabGroupAttributes (group * gitlab.Group , want * testAccGitlabGroupExpectedAttributes ) resource.TestCheckFunc {
@@ -254,10 +297,46 @@ func testAccCheckGitlabGroupAttributes(group *gitlab.Group, want *testAccGitlabG
254297 return fmt .Errorf ("got lfs_enabled %t; want %t" , group .LFSEnabled , want .LFSEnabled )
255298 }
256299
300+ if group .Visibility != want .Visibility {
301+ return fmt .Errorf ("got request_visibility_level: %q; want %q" , group .Visibility , want .Visibility )
302+ }
303+
304+ if group .AutoDevopsEnabled != want .AutoDevopsEnabled {
305+ return fmt .Errorf ("got request_auto_devops_enabled: %t; want %t" , group .AutoDevopsEnabled , want .AutoDevopsEnabled )
306+ }
307+
308+ if group .EmailsDisabled != want .EmailsDisabled {
309+ return fmt .Errorf ("got request_emails_disabled: %t; want %t" , group .EmailsDisabled , want .EmailsDisabled )
310+ }
311+
312+ if group .MentionsDisabled != want .MentionsDisabled {
313+ return fmt .Errorf ("got request_mentions_disabled: %t; want %t" , group .MentionsDisabled , want .MentionsDisabled )
314+ }
315+
257316 if group .RequestAccessEnabled != want .RequestAccessEnabled {
258317 return fmt .Errorf ("got request_access_enabled %t; want %t" , group .RequestAccessEnabled , want .RequestAccessEnabled )
259318 }
260319
320+ if group .ProjectCreationLevel != want .ProjectCreationLevel {
321+ return fmt .Errorf ("got project_creation_level %s; want %s" , group .ProjectCreationLevel , want .ProjectCreationLevel )
322+ }
323+
324+ if group .SubGroupCreationLevel != want .SubGroupCreationLevel {
325+ return fmt .Errorf ("got subgroup_creation_level %s; want %s" , group .SubGroupCreationLevel , want .SubGroupCreationLevel )
326+ }
327+
328+ if group .RequireTwoFactorAuth != want .RequireTwoFactorAuth {
329+ return fmt .Errorf ("got require_two_factor_authentication %t; want %t" , group .RequireTwoFactorAuth , want .RequireTwoFactorAuth )
330+ }
331+
332+ if group .TwoFactorGracePeriod != want .TwoFactorGracePeriod {
333+ return fmt .Errorf ("got two_factor_grace_period %d; want %d" , group .TwoFactorGracePeriod , want .TwoFactorGracePeriod )
334+ }
335+
336+ if group .ShareWithGroupLock != want .ShareWithGroupLock {
337+ return fmt .Errorf ("got share_with_group_lock %t; want %t" , group .ShareWithGroupLock , want .ShareWithGroupLock )
338+ }
339+
261340 if want .Parent != nil {
262341 if group .ParentID != want .Parent .ID {
263342 return fmt .Errorf ("got parent_id %d; want %d" , group .ParentID , want .Parent .ID )
@@ -318,6 +397,14 @@ resource "gitlab_group" "foo" {
318397 description = "Terraform acceptance tests! Updated description"
319398 lfs_enabled = false
320399 request_access_enabled = true
400+ project_creation_level = "developer"
401+ subgroup_creation_level = "maintainer"
402+ require_two_factor_authentication = true
403+ two_factor_grace_period = 56
404+ auto_devops_enabled = true
405+ emails_disabled = true
406+ mentions_disabled = true
407+ share_with_group_lock = true
321408
322409 # So that acceptance tests can be run in a gitlab organization
323410 # with no billing
0 commit comments