@@ -25,14 +25,17 @@ func TestAccGitlabProject_basic(t *testing.T) {
25
25
Check : resource .ComposeTestCheckFunc (
26
26
testAccCheckGitlabProjectExists ("gitlab_project.foo" , & project ),
27
27
testAccCheckGitlabProjectAttributes (& project , & testAccGitlabProjectExpectedAttributes {
28
- Name : fmt .Sprintf ("foo-%d" , rInt ),
29
- Path : fmt .Sprintf ("foo.%d" , rInt ),
30
- Description : "Terraform acceptance tests" ,
31
- IssuesEnabled : true ,
32
- MergeRequestsEnabled : true ,
33
- WikiEnabled : true ,
34
- SnippetsEnabled : true ,
35
- Visibility : gitlab .PublicVisibility ,
28
+ Name : fmt .Sprintf ("foo-%d" , rInt ),
29
+ Path : fmt .Sprintf ("foo.%d" , rInt ),
30
+ Description : "Terraform acceptance tests" ,
31
+ IssuesEnabled : true ,
32
+ MergeRequestsEnabled : true ,
33
+ WikiEnabled : true ,
34
+ SnippetsEnabled : true ,
35
+ Visibility : gitlab .PublicVisibility ,
36
+ MergeMethod : gitlab .FastForwardMerge ,
37
+ OnlyAllowMergeIfPipelineSucceeds : true ,
38
+ OnlyAllowMergeIfAllDiscussionsAreResolved : true ,
36
39
}),
37
40
),
38
41
},
@@ -42,27 +45,33 @@ func TestAccGitlabProject_basic(t *testing.T) {
42
45
Check : resource .ComposeTestCheckFunc (
43
46
testAccCheckGitlabProjectExists ("gitlab_project.foo" , & project ),
44
47
testAccCheckGitlabProjectAttributes (& project , & testAccGitlabProjectExpectedAttributes {
45
- Name : fmt .Sprintf ("foo-%d" , rInt ),
46
- Path : fmt .Sprintf ("foo.%d" , rInt ),
47
- Description : "Terraform acceptance tests!" ,
48
- Visibility : gitlab .PublicVisibility ,
48
+ Name : fmt .Sprintf ("foo-%d" , rInt ),
49
+ Path : fmt .Sprintf ("foo.%d" , rInt ),
50
+ Description : "Terraform acceptance tests!" ,
51
+ Visibility : gitlab .PublicVisibility ,
52
+ MergeMethod : gitlab .FastForwardMerge ,
53
+ OnlyAllowMergeIfPipelineSucceeds : true ,
54
+ OnlyAllowMergeIfAllDiscussionsAreResolved : true ,
49
55
}),
50
56
),
51
57
},
52
- //Update the project to turn the features on again
58
+ // Update the project to turn the features on again
53
59
{
54
60
Config : testAccGitlabProjectConfig (rInt ),
55
61
Check : resource .ComposeTestCheckFunc (
56
62
testAccCheckGitlabProjectExists ("gitlab_project.foo" , & project ),
57
63
testAccCheckGitlabProjectAttributes (& project , & testAccGitlabProjectExpectedAttributes {
58
- Name : fmt .Sprintf ("foo-%d" , rInt ),
59
- Path : fmt .Sprintf ("foo.%d" , rInt ),
60
- Description : "Terraform acceptance tests" ,
61
- IssuesEnabled : true ,
62
- MergeRequestsEnabled : true ,
63
- WikiEnabled : true ,
64
- SnippetsEnabled : true ,
65
- Visibility : gitlab .PublicVisibility ,
64
+ Name : fmt .Sprintf ("foo-%d" , rInt ),
65
+ Path : fmt .Sprintf ("foo.%d" , rInt ),
66
+ Description : "Terraform acceptance tests" ,
67
+ IssuesEnabled : true ,
68
+ MergeRequestsEnabled : true ,
69
+ WikiEnabled : true ,
70
+ SnippetsEnabled : true ,
71
+ Visibility : gitlab .PublicVisibility ,
72
+ MergeMethod : gitlab .FastForwardMerge ,
73
+ OnlyAllowMergeIfPipelineSucceeds : true ,
74
+ OnlyAllowMergeIfAllDiscussionsAreResolved : true ,
66
75
}),
67
76
),
68
77
},
@@ -72,14 +81,17 @@ func TestAccGitlabProject_basic(t *testing.T) {
72
81
Check : resource .ComposeTestCheckFunc (
73
82
testAccCheckGitlabProjectExists ("gitlab_project.foo" , & project ),
74
83
testAccCheckGitlabProjectAttributes (& project , & testAccGitlabProjectExpectedAttributes {
75
- Name : fmt .Sprintf ("foo-%d" , rInt ),
76
- Path : fmt .Sprintf ("foo.%d" , rInt ),
77
- Description : "Terraform acceptance tests" ,
78
- IssuesEnabled : true ,
79
- MergeRequestsEnabled : true ,
80
- WikiEnabled : true ,
81
- SnippetsEnabled : true ,
82
- Visibility : gitlab .PublicVisibility ,
84
+ Name : fmt .Sprintf ("foo-%d" , rInt ),
85
+ Path : fmt .Sprintf ("foo.%d" , rInt ),
86
+ Description : "Terraform acceptance tests" ,
87
+ IssuesEnabled : true ,
88
+ MergeRequestsEnabled : true ,
89
+ WikiEnabled : true ,
90
+ SnippetsEnabled : true ,
91
+ Visibility : gitlab .PublicVisibility ,
92
+ MergeMethod : gitlab .FastForwardMerge ,
93
+ OnlyAllowMergeIfPipelineSucceeds : false ,
94
+ OnlyAllowMergeIfAllDiscussionsAreResolved : false ,
83
95
SharedWithGroups : []struct {
84
96
GroupID int
85
97
GroupName string
@@ -94,14 +106,17 @@ func TestAccGitlabProject_basic(t *testing.T) {
94
106
Check : resource .ComposeTestCheckFunc (
95
107
testAccCheckGitlabProjectExists ("gitlab_project.foo" , & project ),
96
108
testAccCheckGitlabProjectAttributes (& project , & testAccGitlabProjectExpectedAttributes {
97
- Name : fmt .Sprintf ("foo-%d" , rInt ),
98
- Path : fmt .Sprintf ("foo.%d" , rInt ),
99
- Description : "Terraform acceptance tests" ,
100
- IssuesEnabled : true ,
101
- MergeRequestsEnabled : true ,
102
- WikiEnabled : true ,
103
- SnippetsEnabled : true ,
104
- Visibility : gitlab .PublicVisibility ,
109
+ Name : fmt .Sprintf ("foo-%d" , rInt ),
110
+ Path : fmt .Sprintf ("foo.%d" , rInt ),
111
+ Description : "Terraform acceptance tests" ,
112
+ IssuesEnabled : true ,
113
+ MergeRequestsEnabled : true ,
114
+ WikiEnabled : true ,
115
+ SnippetsEnabled : true ,
116
+ Visibility : gitlab .PublicVisibility ,
117
+ MergeMethod : gitlab .FastForwardMerge ,
118
+ OnlyAllowMergeIfPipelineSucceeds : false ,
119
+ OnlyAllowMergeIfAllDiscussionsAreResolved : false ,
105
120
SharedWithGroups : []struct {
106
121
GroupID int
107
122
GroupName string
@@ -116,14 +131,17 @@ func TestAccGitlabProject_basic(t *testing.T) {
116
131
Check : resource .ComposeTestCheckFunc (
117
132
testAccCheckGitlabProjectExists ("gitlab_project.foo" , & project ),
118
133
testAccCheckGitlabProjectAttributes (& project , & testAccGitlabProjectExpectedAttributes {
119
- Name : fmt .Sprintf ("foo-%d" , rInt ),
120
- Path : fmt .Sprintf ("foo.%d" , rInt ),
121
- Description : "Terraform acceptance tests" ,
122
- IssuesEnabled : true ,
123
- MergeRequestsEnabled : true ,
124
- WikiEnabled : true ,
125
- SnippetsEnabled : true ,
126
- Visibility : gitlab .PublicVisibility ,
134
+ Name : fmt .Sprintf ("foo-%d" , rInt ),
135
+ Path : fmt .Sprintf ("foo.%d" , rInt ),
136
+ Description : "Terraform acceptance tests" ,
137
+ IssuesEnabled : true ,
138
+ MergeRequestsEnabled : true ,
139
+ WikiEnabled : true ,
140
+ SnippetsEnabled : true ,
141
+ Visibility : gitlab .PublicVisibility ,
142
+ MergeMethod : gitlab .FastForwardMerge ,
143
+ OnlyAllowMergeIfPipelineSucceeds : true ,
144
+ OnlyAllowMergeIfAllDiscussionsAreResolved : true ,
127
145
SharedWithGroups : []struct {
128
146
GroupID int
129
147
GroupName string
@@ -199,16 +217,19 @@ func testAccCheckGitlabProjectExists(n string, project *gitlab.Project) resource
199
217
}
200
218
201
219
type testAccGitlabProjectExpectedAttributes struct {
202
- Name string
203
- Path string
204
- Description string
205
- DefaultBranch string
206
- IssuesEnabled bool
207
- MergeRequestsEnabled bool
208
- WikiEnabled bool
209
- SnippetsEnabled bool
210
- Visibility gitlab.VisibilityValue
211
- SharedWithGroups []struct {
220
+ Name string
221
+ Path string
222
+ Description string
223
+ DefaultBranch string
224
+ IssuesEnabled bool
225
+ MergeRequestsEnabled bool
226
+ WikiEnabled bool
227
+ SnippetsEnabled bool
228
+ Visibility gitlab.VisibilityValue
229
+ MergeMethod gitlab.MergeMethodValue
230
+ OnlyAllowMergeIfPipelineSucceeds bool
231
+ OnlyAllowMergeIfAllDiscussionsAreResolved bool
232
+ SharedWithGroups []struct {
212
233
GroupID int
213
234
GroupName string
214
235
GroupAccessLevel int
@@ -257,6 +278,18 @@ func testAccCheckGitlabProjectAttributes(project *gitlab.Project, want *testAccG
257
278
}
258
279
}
259
280
281
+ if project .MergeMethod != want .MergeMethod {
282
+ return fmt .Errorf ("got merge_method %q; want %q" , project .MergeMethod , want .MergeMethod )
283
+ }
284
+
285
+ if project .OnlyAllowMergeIfPipelineSucceeds != want .OnlyAllowMergeIfPipelineSucceeds {
286
+ return fmt .Errorf ("got only_allow_merge_if_pipeline_succeeds %t; want %t" , project .OnlyAllowMergeIfPipelineSucceeds , want .OnlyAllowMergeIfPipelineSucceeds )
287
+ }
288
+
289
+ if project .OnlyAllowMergeIfAllDiscussionsAreResolved != want .OnlyAllowMergeIfAllDiscussionsAreResolved {
290
+ return fmt .Errorf ("got only_allow_merge_if_all_discussions_are_resolved %t; want %t" , project .OnlyAllowMergeIfAllDiscussionsAreResolved , want .OnlyAllowMergeIfAllDiscussionsAreResolved )
291
+ }
292
+
260
293
return nil
261
294
}
262
295
}
@@ -313,6 +346,9 @@ resource "gitlab_project" "foo" {
313
346
# So that acceptance tests can be run in a gitlab organization
314
347
# with no billing
315
348
visibility_level = "public"
349
+ merge_method = "ff"
350
+ only_allow_merge_if_pipeline_succeeds = true
351
+ only_allow_merge_if_all_discussions_are_resolved = true
316
352
}
317
353
` , rInt , rInt )
318
354
}
@@ -327,6 +363,9 @@ resource "gitlab_project" "foo" {
327
363
# So that acceptance tests can be run in a gitlab organization
328
364
# with no billing
329
365
visibility_level = "public"
366
+ merge_method = "ff"
367
+ only_allow_merge_if_pipeline_succeeds = true
368
+ only_allow_merge_if_all_discussions_are_resolved = true
330
369
331
370
issues_enabled = false
332
371
merge_requests_enabled = false
@@ -343,6 +382,9 @@ resource "gitlab_project" "foo" {
343
382
path = "foo.%d"
344
383
description = "Terraform acceptance tests"
345
384
visibility_level = "public"
385
+ merge_method = "ff"
386
+ only_allow_merge_if_pipeline_succeeds = false
387
+ only_allow_merge_if_all_discussions_are_resolved = false
346
388
347
389
shared_with_groups = [
348
390
{
@@ -368,6 +410,9 @@ resource "gitlab_project" "foo" {
368
410
path = "foo.%d"
369
411
description = "Terraform acceptance tests"
370
412
visibility_level = "public"
413
+ merge_method = "ff"
414
+ only_allow_merge_if_pipeline_succeeds = false
415
+ only_allow_merge_if_all_discussions_are_resolved = false
371
416
372
417
shared_with_groups = [
373
418
{
0 commit comments