Skip to content

Commit e0a88ff

Browse files
committed
Fix test for repository file for GitLab 14.9 testing
1 parent 65865a1 commit e0a88ff

File tree

2 files changed

+54
-2
lines changed

2 files changed

+54
-2
lines changed

internal/provider/data_source_gitlab_repository_file_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ resource "gitlab_repository_file" "foo" {
6666
branch = "main"
6767
content = base64encode("Meow goes the cat")
6868
commit_message = "feat: Meow"
69-
execute_filemode = true
7069
}
7170
7271
data "gitlab_repository_file" "foo" {

internal/provider/resource_gitlab_repository_file_test.go

+54-1
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,60 @@ func TestAccGitlabRepositoryFile_base64EncodingWithTextContent(t *testing.T) {
239239
})
240240
}
241241

242+
func TestAccGitlabRepositoryFile_createWithExecuteFilemode(t *testing.T) {
243+
testProject := testAccCreateProject(t)
244+
245+
resource.Test(t, resource.TestCase{
246+
PreCheck: func() { testAccRequiresAtLeast(t, "14.10") },
247+
ProviderFactories: providerFactories,
248+
CheckDestroy: testAccCheckGitlabRepositoryFileDestroy,
249+
Steps: []resource.TestStep{
250+
{
251+
Config: fmt.Sprintf(`
252+
resource "gitlab_repository_file" "this" {
253+
project = %d
254+
file_path = "meow.txt"
255+
branch = "main"
256+
content = "bWVvdyBtZW93IG1lb3cgbWVvdyBtZW93Cg=="
257+
author_email = "[email protected]"
258+
author_name = "Meow Meowington"
259+
commit_message = "feature: change launch codes"
260+
execute_filemode = false
261+
}
262+
`, testProject.ID),
263+
},
264+
// Verify Import
265+
{
266+
ResourceName: "gitlab_repository_file.this",
267+
ImportState: true,
268+
ImportStateVerify: true,
269+
ImportStateVerifyIgnore: []string{"author_email", "author_name", "commit_message"},
270+
},
271+
{
272+
Config: fmt.Sprintf(`
273+
resource "gitlab_repository_file" "this" {
274+
project = %d
275+
file_path = "meow.txt"
276+
branch = "main"
277+
content = "bWVvdyBtZW93IG1lb3cgbWVvdyBtZW93Cg=="
278+
author_email = "[email protected]"
279+
author_name = "Meow Meowington"
280+
commit_message = "feature: change launch codes"
281+
execute_filemode = true
282+
}
283+
`, testProject.ID),
284+
},
285+
// Verify Import
286+
{
287+
ResourceName: "gitlab_repository_file.this",
288+
ImportState: true,
289+
ImportStateVerify: true,
290+
ImportStateVerifyIgnore: []string{"author_email", "author_name", "commit_message"},
291+
},
292+
},
293+
})
294+
}
295+
242296
func testAccCheckGitlabRepositoryFileExists(n string, file *gitlab.File) resource.TestCheckFunc {
243297
return func(s *terraform.State) error {
244298
rs, ok := s.RootModule().Resources[n]
@@ -354,7 +408,6 @@ resource "gitlab_repository_file" "this" {
354408
author_email = "[email protected]"
355409
author_name = "Meow Meowington"
356410
commit_message = "feature: change launch codes"
357-
execute_filemode = true
358411
}
359412
`, projectID)
360413
}

0 commit comments

Comments
 (0)