@@ -18,7 +18,7 @@ type testAccGitlabProjectExpectedAttributes struct {
18
18
}
19
19
20
20
func TestAccGitlabProject_basic (t * testing.T ) {
21
- var received , defaults , defaultsMasterBranch gitlab.Project
21
+ var received , defaults , defaultsMainBranch gitlab.Project
22
22
rInt := acctest .RandInt ()
23
23
24
24
defaults = gitlab.Project {
@@ -46,8 +46,8 @@ func TestAccGitlabProject_basic(t *testing.T) {
46
46
PagesAccessLevel : gitlab .PublicAccessControl ,
47
47
}
48
48
49
- defaultsMasterBranch = defaults
50
- defaultsMasterBranch .DefaultBranch = "master "
49
+ defaultsMainBranch = defaults
50
+ defaultsMainBranch .DefaultBranch = "main "
51
51
52
52
resource .Test (t , resource.TestCase {
53
53
PreCheck : func () { testAccPreCheck (t ) },
@@ -100,11 +100,11 @@ func TestAccGitlabProject_basic(t *testing.T) {
100
100
// Update the project creating the default branch
101
101
{
102
102
// Get the ID from the project data at the previous step
103
- SkipFunc : testAccGitlabProjectConfigDefaultBranchSkipFunc (& received , "master " ),
104
- Config : testAccGitlabProjectConfigDefaultBranch (rInt , "master " ),
103
+ SkipFunc : testAccGitlabProjectConfigDefaultBranchSkipFunc (& received , "main " ),
104
+ Config : testAccGitlabProjectConfigDefaultBranch (rInt , "main " ),
105
105
Check : resource .ComposeTestCheckFunc (
106
106
testAccCheckGitlabProjectExists ("gitlab_project.foo" , & received ),
107
- testAccCheckAggregateGitlabProject (& defaultsMasterBranch , & received ),
107
+ testAccCheckAggregateGitlabProject (& defaultsMainBranch , & received ),
108
108
),
109
109
},
110
110
// Test import without push rules (checks read function)
@@ -198,7 +198,7 @@ max_file_size = 1234
198
198
// NOTE: The push rules will still exist upstream because the push_rules block is computed.
199
199
{
200
200
SkipFunc : isRunningInCE ,
201
- Config : testAccGitlabProjectConfigDefaultBranch (rInt , "master " ),
201
+ Config : testAccGitlabProjectConfigDefaultBranch (rInt , "main " ),
202
202
Check : testAccCheckGitlabProjectPushRules ("gitlab_project.foo" , & gitlab.ProjectPushRules {
203
203
AuthorEmailRegex : "foo_author" ,
204
204
}),
@@ -213,7 +213,7 @@ max_file_size = 1234
213
213
},
214
214
// Destroy the project so we can next test creating a project with push rules simultaneously
215
215
{
216
- Config : testAccGitlabProjectConfigDefaultBranch (rInt , "master " ),
216
+ Config : testAccGitlabProjectConfigDefaultBranch (rInt , "main " ),
217
217
Destroy : true ,
218
218
Check : testAccCheckGitlabProjectDestroy ,
219
219
},
@@ -325,7 +325,7 @@ func TestAccGitlabProject_initializeWithReadme(t *testing.T) {
325
325
Check : resource .ComposeTestCheckFunc (
326
326
testAccCheckGitlabProjectExists ("gitlab_project.foo" , & project ),
327
327
testAccCheckGitlabProjectDefaultBranch (& project , & testAccGitlabProjectExpectedAttributes {
328
- DefaultBranch : "master " ,
328
+ DefaultBranch : "main " ,
329
329
}),
330
330
),
331
331
},
@@ -506,7 +506,7 @@ func TestAccGitlabProject_importURL(t *testing.T) {
506
506
507
507
// Add a file to the base project, for later verifying the import.
508
508
_ , _ , err = client .RepositoryFiles .CreateFile (baseProject .ID , "foo.txt" , & gitlab.CreateFileOptions {
509
- Branch : gitlab .String ("master " ),
509
+ Branch : gitlab .String ("main " ),
510
510
CommitMessage : gitlab .String ("add file" ),
511
511
Content : gitlab .String ("" ),
512
512
})
@@ -526,7 +526,7 @@ func TestAccGitlabProject_importURL(t *testing.T) {
526
526
func (state * terraform.State ) error {
527
527
projectID := state .RootModule ().Resources ["gitlab_project.imported" ].Primary .ID
528
528
529
- _ , _ , err := client .RepositoryFiles .GetFile (projectID , "foo.txt" , & gitlab.GetFileOptions {Ref : gitlab .String ("master " )}, nil )
529
+ _ , _ , err := client .RepositoryFiles .GetFile (projectID , "foo.txt" , & gitlab.GetFileOptions {Ref : gitlab .String ("main " )}, nil )
530
530
if err != nil {
531
531
return fmt .Errorf ("failed to get file from imported project: %w" , err )
532
532
}
@@ -590,7 +590,7 @@ func TestAccGitlabProject_importURLMirrored(t *testing.T) {
590
590
591
591
// Add a file to the base project, for later verifying the import.
592
592
_ , _ , err = client .RepositoryFiles .CreateFile (baseProject .ID , "foo.txt" , & gitlab.CreateFileOptions {
593
- Branch : gitlab .String ("master " ),
593
+ Branch : gitlab .String ("main " ),
594
594
CommitMessage : gitlab .String ("add file" ),
595
595
Content : gitlab .String ("" ),
596
596
})
@@ -620,7 +620,7 @@ func TestAccGitlabProject_importURLMirrored(t *testing.T) {
620
620
func (state * terraform.State ) error {
621
621
projectID := state .RootModule ().Resources ["gitlab_project.imported" ].Primary .ID
622
622
623
- _ , _ , err := client .RepositoryFiles .GetFile (projectID , "foo.txt" , & gitlab.GetFileOptions {Ref : gitlab .String ("master " )}, nil )
623
+ _ , _ , err := client .RepositoryFiles .GetFile (projectID , "foo.txt" , & gitlab.GetFileOptions {Ref : gitlab .String ("main " )}, nil )
624
624
if err != nil {
625
625
return fmt .Errorf ("failed to get file from imported project: %w" , err )
626
626
}
@@ -647,7 +647,7 @@ func TestAccGitlabProject_importURLMirrored(t *testing.T) {
647
647
func (state * terraform.State ) error {
648
648
projectID := state .RootModule ().Resources ["gitlab_project.imported" ].Primary .ID
649
649
650
- _ , _ , err := client .RepositoryFiles .GetFile (projectID , "foo.txt" , & gitlab.GetFileOptions {Ref : gitlab .String ("master " )}, nil )
650
+ _ , _ , err := client .RepositoryFiles .GetFile (projectID , "foo.txt" , & gitlab.GetFileOptions {Ref : gitlab .String ("main " )}, nil )
651
651
if err != nil {
652
652
return fmt .Errorf ("failed to get file from imported project: %w" , err )
653
653
}
@@ -674,7 +674,7 @@ func TestAccGitlabProject_importURLMirrored(t *testing.T) {
674
674
func (state * terraform.State ) error {
675
675
projectID := state .RootModule ().Resources ["gitlab_project.imported" ].Primary .ID
676
676
677
- _ , _ , err := client .RepositoryFiles .GetFile (projectID , "foo.txt" , & gitlab.GetFileOptions {Ref : gitlab .String ("master " )}, nil )
677
+ _ , _ , err := client .RepositoryFiles .GetFile (projectID , "foo.txt" , & gitlab.GetFileOptions {Ref : gitlab .String ("main " )}, nil )
678
678
if err != nil {
679
679
return fmt .Errorf ("failed to get file from imported project: %w" , err )
680
680
}
@@ -1015,7 +1015,7 @@ func testAccGitlabProjectConfigImportURL(rInt int, importURL string) string {
1015
1015
return fmt .Sprintf (`
1016
1016
resource "gitlab_project" "imported" {
1017
1017
name = "imported-%d"
1018
- default_branch = "master "
1018
+ default_branch = "main "
1019
1019
import_url = "%s"
1020
1020
1021
1021
# So that acceptance tests can be run in a gitlab organization
@@ -1029,7 +1029,7 @@ func testAccGitlabProjectConfigImportURLMirror(rInt int, importURL string) strin
1029
1029
return fmt .Sprintf (`
1030
1030
resource "gitlab_project" "imported" {
1031
1031
name = "imported-%d"
1032
- default_branch = "master "
1032
+ default_branch = "main "
1033
1033
import_url = "%s"
1034
1034
mirror = true
1035
1035
mirror_trigger_builds = true
@@ -1047,7 +1047,7 @@ func testAccGitlabProjectConfigImportURLMirrorDisabledOptionals(rInt int, import
1047
1047
return fmt .Sprintf (`
1048
1048
resource "gitlab_project" "imported" {
1049
1049
name = "imported-%d"
1050
- default_branch = "master "
1050
+ default_branch = "main "
1051
1051
import_url = "%s"
1052
1052
mirror = true
1053
1053
mirror_trigger_builds = false
@@ -1065,7 +1065,7 @@ func testAccGitlabProjectConfigImportURLMirrorDisabled(rInt int, importURL strin
1065
1065
return fmt .Sprintf (`
1066
1066
resource "gitlab_project" "imported" {
1067
1067
name = "imported-%d"
1068
- default_branch = "master "
1068
+ default_branch = "main "
1069
1069
import_url = "%s"
1070
1070
mirror = false
1071
1071
mirror_trigger_builds = false
@@ -1085,7 +1085,7 @@ resource "gitlab_project" "foo" {
1085
1085
name = "foo-%[1]d"
1086
1086
path = "foo.%[1]d"
1087
1087
description = "Terraform acceptance tests"
1088
- default_branch = "master "
1088
+ default_branch = "main "
1089
1089
1090
1090
push_rules {
1091
1091
%[2]s
@@ -1112,7 +1112,7 @@ resource "gitlab_project" "template-name" {
1112
1112
// 2020-09-07: Currently Gitlab (version 13.3.6 ) doesn't allow in admin API
1113
1113
// ability to set a group as instance level templates.
1114
1114
// To test resource_gitlab_project_test template features we add
1115
- // group, project myrails and admin settings directly in scripts/start-gitlab .sh
1115
+ // group, project myrails and admin settings directly in scripts/healthcheck-and-setup .sh
1116
1116
// Once Gitlab add admin template in API we could manage group/project/settings
1117
1117
// directly in tests like TestAccGitlabProject_basic.
1118
1118
func testAccGitlabProjectConfigTemplateNameCustom (rInt int ) string {
0 commit comments