@@ -18,17 +18,30 @@ func TestAccDataSourceGitlabRepositoryTree_basic(t *testing.T) {
18
18
Steps : []resource.TestStep {
19
19
{
20
20
Config : fmt .Sprintf (`
21
+ resource "gitlab_repository_file" "foo" {
22
+ project = "%[1]d"
23
+ file_path = "testfile-meow"
24
+ branch = "%[2]s"
25
+ content = base64encode("Meow goes the cat")
26
+ commit_message = "feat: Meow"
27
+ }
28
+
21
29
data "gitlab_repository_tree" "this" {
22
- project = %d
23
- ref = "%s"
30
+ project = %[1] d
31
+ ref = gitlab_repository_file.foo.branch
24
32
}
25
33
` , testProject .ID , testProject .DefaultBranch ),
26
34
Check : resource .ComposeTestCheckFunc (
27
- resource .TestCheckResourceAttr ("data.gitlab_repository_tree.this" , "tree.#" , "1 " ),
35
+ resource .TestCheckResourceAttr ("data.gitlab_repository_tree.this" , "tree.#" , "2 " ),
28
36
resource .TestCheckResourceAttr ("data.gitlab_repository_tree.this" , "tree.0.name" , "README.md" ),
29
37
resource .TestCheckResourceAttr ("data.gitlab_repository_tree.this" , "tree.0.type" , "blob" ),
30
38
resource .TestCheckResourceAttr ("data.gitlab_repository_tree.this" , "tree.0.path" , "README.md" ),
31
39
resource .TestCheckResourceAttr ("data.gitlab_repository_tree.this" , "tree.0.mode" , "100644" ),
40
+
41
+ resource .TestCheckResourceAttr ("data.gitlab_repository_tree.this" , "tree.1.name" , "testfile-meow" ),
42
+ resource .TestCheckResourceAttr ("data.gitlab_repository_tree.this" , "tree.1.type" , "blob" ),
43
+ resource .TestCheckResourceAttr ("data.gitlab_repository_tree.this" , "tree.1.path" , "testfile-meow" ),
44
+ resource .TestCheckResourceAttr ("data.gitlab_repository_tree.this" , "tree.1.mode" , "100644" ),
32
45
),
33
46
},
34
47
},
0 commit comments