@@ -600,24 +600,29 @@ func TestAccGitlabProject_transfer(t *testing.T) {
600
600
CIForwardDeploymentEnabled : true ,
601
601
}
602
602
603
+ pathBeforeTransfer := fmt .Sprintf ("foogroup-%d/foo-%d" , rInt , rInt )
604
+ pathAfterTransfer := fmt .Sprintf ("foo2group-%d/foo-%d" , rInt , rInt )
605
+
603
606
resource .Test (t , resource.TestCase {
604
607
PreCheck : func () { testAccPreCheck (t ) },
605
608
ProviderFactories : providerFactories ,
606
609
CheckDestroy : testAccCheckGitlabProjectDestroy ,
607
610
Steps : []resource.TestStep {
608
611
// Create a project in a group
609
612
{
610
- Config : testAccGitlabProjectInGroupConfig (rInt ),
613
+ Config : testAccGitlabProjectTransferBetweenGroupsBefore (rInt ),
611
614
Check : resource .ComposeTestCheckFunc (
612
615
testAccCheckGitlabProjectExists ("gitlab_project.foo" , & received ),
616
+ resource .TestCheckResourceAttrPtr ("gitlab_project_variable.foo" , "value" , & pathBeforeTransfer ),
613
617
),
614
618
},
615
619
// Create a second group and set the transfer the project to this group
616
620
{
617
- Config : testAccGitlabProjectTransferBetweenGroups (rInt ),
621
+ Config : testAccGitlabProjectTransferBetweenGroupsAfter (rInt ),
618
622
Check : resource .ComposeTestCheckFunc (
619
623
testAccCheckGitlabProjectExists ("gitlab_project.foo" , & received ),
620
624
testAccCheckAggregateGitlabProject (& transferred , & received ),
625
+ resource .TestCheckResourceAttrPtr ("gitlab_project_variable.foo" , "value" , & pathAfterTransfer ),
621
626
),
622
627
},
623
628
},
@@ -1117,7 +1122,35 @@ resource "gitlab_project" "foo" {
1117
1122
` , rInt , rInt , rInt )
1118
1123
}
1119
1124
1120
- func testAccGitlabProjectTransferBetweenGroups (rInt int ) string {
1125
+ func testAccGitlabProjectTransferBetweenGroupsBefore (rInt int ) string {
1126
+ return fmt .Sprintf (`
1127
+ resource "gitlab_group" "foo" {
1128
+ name = "foogroup-%d"
1129
+ path = "foogroup-%d"
1130
+ visibility_level = "public"
1131
+ }
1132
+
1133
+ resource "gitlab_project" "foo" {
1134
+ name = "foo-%d"
1135
+ description = "Terraform acceptance tests"
1136
+ namespace_id = "${gitlab_group.foo.id}"
1137
+
1138
+ # So that acceptance tests can be run in a gitlab organization
1139
+ # with no billing
1140
+ visibility_level = "public"
1141
+ build_coverage_regex = "foo"
1142
+ }
1143
+
1144
+ resource "gitlab_project_variable" "foo" {
1145
+ project = "${gitlab_project.foo.id}"
1146
+
1147
+ key = "FOO"
1148
+ value = "${gitlab_project.foo.path_with_namespace}"
1149
+ }
1150
+ ` , rInt , rInt , rInt )
1151
+ }
1152
+
1153
+ func testAccGitlabProjectTransferBetweenGroupsAfter (rInt int ) string {
1121
1154
return fmt .Sprintf (`
1122
1155
resource "gitlab_group" "foo" {
1123
1156
name = "foogroup-%d"
@@ -1141,6 +1174,13 @@ resource "gitlab_project" "foo" {
1141
1174
visibility_level = "public"
1142
1175
build_coverage_regex = "foo"
1143
1176
}
1177
+
1178
+ resource "gitlab_project_variable" "foo" {
1179
+ project = "${gitlab_project.foo.id}"
1180
+
1181
+ key = "FOO"
1182
+ value = "${gitlab_project.foo.path_with_namespace}"
1183
+ }
1144
1184
` , rInt , rInt , rInt , rInt , rInt )
1145
1185
}
1146
1186
0 commit comments