@@ -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
@@ -264,6 +285,18 @@ func testAccCheckGitlabProjectAttributes(project *gitlab.Project, want *testAccG
264
285
return fmt .Errorf ("got shared with groups: %v; want %v" , project .SharedWithGroups , want .SharedWithGroups )
265
286
}
266
287
288
+ if project .MergeMethod != want .MergeMethod {
289
+ return fmt .Errorf ("got merge_method %q; want %q" , project .MergeMethod , want .MergeMethod )
290
+ }
291
+
292
+ if project .OnlyAllowMergeIfPipelineSucceeds != want .OnlyAllowMergeIfPipelineSucceeds {
293
+ return fmt .Errorf ("got only_allow_merge_if_pipeline_succeeds %t; want %t" , project .OnlyAllowMergeIfPipelineSucceeds , want .OnlyAllowMergeIfPipelineSucceeds )
294
+ }
295
+
296
+ if project .OnlyAllowMergeIfAllDiscussionsAreResolved != want .OnlyAllowMergeIfAllDiscussionsAreResolved {
297
+ return fmt .Errorf ("got only_allow_merge_if_all_discussions_are_resolved %t; want %t" , project .OnlyAllowMergeIfAllDiscussionsAreResolved , want .OnlyAllowMergeIfAllDiscussionsAreResolved )
298
+ }
299
+
267
300
return nil
268
301
}
269
302
}
@@ -320,6 +353,9 @@ resource "gitlab_project" "foo" {
320
353
# So that acceptance tests can be run in a gitlab organization
321
354
# with no billing
322
355
visibility_level = "public"
356
+ merge_method = "ff"
357
+ only_allow_merge_if_pipeline_succeeds = true
358
+ only_allow_merge_if_all_discussions_are_resolved = true
323
359
}
324
360
` , rInt , rInt )
325
361
}
@@ -334,6 +370,9 @@ resource "gitlab_project" "foo" {
334
370
# So that acceptance tests can be run in a gitlab organization
335
371
# with no billing
336
372
visibility_level = "public"
373
+ merge_method = "ff"
374
+ only_allow_merge_if_pipeline_succeeds = true
375
+ only_allow_merge_if_all_discussions_are_resolved = true
337
376
338
377
issues_enabled = false
339
378
merge_requests_enabled = false
@@ -350,6 +389,9 @@ resource "gitlab_project" "foo" {
350
389
path = "foo.%d"
351
390
description = "Terraform acceptance tests"
352
391
visibility_level = "public"
392
+ merge_method = "ff"
393
+ only_allow_merge_if_pipeline_succeeds = false
394
+ only_allow_merge_if_all_discussions_are_resolved = false
353
395
354
396
shared_with_groups = [
355
397
{
@@ -375,6 +417,9 @@ resource "gitlab_project" "foo" {
375
417
path = "foo.%d"
376
418
description = "Terraform acceptance tests"
377
419
visibility_level = "public"
420
+ merge_method = "ff"
421
+ only_allow_merge_if_pipeline_succeeds = false
422
+ only_allow_merge_if_all_discussions_are_resolved = false
378
423
379
424
shared_with_groups = [
380
425
{
0 commit comments