Skip to content

Commit 3aa80ad

Browse files
committed
Test creating project in group without default branch protection. Closes #759, #760
Closes #759 Closes #760
1 parent 087f021 commit 3aa80ad

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

internal/provider/resource_gitlab_project_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,23 @@ member_check = false
411411
})
412412
}
413413

414+
func TestAccGitlabProject_groupWithoutDefaultBranchProtection(t *testing.T) {
415+
var project gitlab.Project
416+
rInt := acctest.RandInt()
417+
418+
resource.Test(t, resource.TestCase{
419+
PreCheck: func() { testAccPreCheck(t) },
420+
ProviderFactories: providerFactories,
421+
CheckDestroy: testAccCheckGitlabProjectDestroy,
422+
Steps: []resource.TestStep{
423+
{
424+
Config: testAccGitlabProjectConfigWithoutDefaultBranchProtection(rInt),
425+
Check: testAccCheckGitlabProjectExists("gitlab_project.foo", &project),
426+
},
427+
},
428+
})
429+
}
430+
414431
func TestAccGitlabProject_IssueMergeRequestTemplates(t *testing.T) {
415432
var project gitlab.Project
416433
rInt := acctest.RandInt()
@@ -1075,6 +1092,23 @@ resource "gitlab_project" "foo" {
10751092
`, rInt, rInt, rInt)
10761093
}
10771094

1095+
func testAccGitlabProjectConfigWithoutDefaultBranchProtection(rInt int) string {
1096+
return fmt.Sprintf(`
1097+
resource "gitlab_group" "foo" {
1098+
name = "foogroup-%d"
1099+
path = "foogroup-%d"
1100+
default_branch_protection = 0
1101+
visibility_level = "public"
1102+
}
1103+
1104+
resource "gitlab_project" "foo" {
1105+
name = "foo-%d"
1106+
description = "Terraform acceptance tests"
1107+
namespace_id = "${gitlab_group.foo.id}"
1108+
}
1109+
`, rInt, rInt, rInt)
1110+
}
1111+
10781112
func testAccGitlabProjectTransferBetweenGroups(rInt int) string {
10791113
return fmt.Sprintf(`
10801114
resource "gitlab_group" "foo" {

0 commit comments

Comments
 (0)