Skip to content

Commit 5b3cad3

Browse files
committed
Use test helpers and add update test
1 parent 7d42e64 commit 5b3cad3

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

internal/provider/resource_gitlab_group_test.go

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,15 @@ func TestAccGitlabGroup_PreventForkingOutsideGroup(t *testing.T) {
260260
Config: testAccGitlabGroupPreventForkingOutsideGroupConfig(rInt),
261261
Check: resource.ComposeTestCheckFunc(
262262
testAccCheckGitlabGroupExists("gitlab_group.foo", &group),
263-
func(s *terraform.State) error {
264-
if group.PreventForkingOutsideGroup != true {
265-
return fmt.Errorf("expected forking outside the group to be disabled")
266-
}
267-
268-
return nil
269-
},
263+
resource.TestCheckResourceAttr("gitlab_group.foo", "prevent_forking_outside_group", "true"),
264+
),
265+
},
266+
{
267+
SkipFunc: isRunningInCE,
268+
Config: testAccGitlabGroupPreventForkingOutsideGroupUpdateConfig(rInt),
269+
Check: resource.ComposeTestCheckFunc(
270+
testAccCheckGitlabGroupExists("gitlab_group.foo", &group),
271+
resource.TestCheckResourceAttr("gitlab_group.foo", "prevent_forking_outside_group", "false"),
270272
),
271273
},
272274
},
@@ -587,3 +589,19 @@ resource "gitlab_group" "foo" {
587589
}
588590
`, rInt, rInt)
589591
}
592+
593+
func testAccGitlabGroupPreventForkingOutsideGroupUpdateConfig(rInt int) string {
594+
return fmt.Sprintf(`
595+
resource "gitlab_group" "foo" {
596+
name = "foo-name-%d"
597+
path = "foo-path-%d"
598+
description = "Terraform acceptance tests"
599+
600+
# So that acceptance tests can be run in a gitlab organization
601+
# with no billing
602+
visibility_level = "public"
603+
604+
prevent_forking_outside_group = false
605+
}
606+
`, rInt, rInt)
607+
}

0 commit comments

Comments
 (0)