Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3a98b58

Browse files
committedJun 24, 2024·
attempting data source testing
1 parent 0c57de0 commit 3a98b58

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
 

‎provider/examples_test.go

+21
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
func TestExamples(t *testing.T) {
1515
t.Parallel()
1616

17+
// Resource examples
1718
for _, testDir := range []string{
1819
"coder_workspace_tags",
1920
} {
@@ -32,6 +33,26 @@ func TestExamples(t *testing.T) {
3233
})
3334
})
3435
}
36+
37+
// Data source examples
38+
for _, testDir := range []string{
39+
"coder_parameter",
40+
} {
41+
t.Run(testDir, func(t *testing.T) {
42+
testDir := testDir
43+
t.Parallel()
44+
45+
resource.Test(t, resource.TestCase{
46+
Providers: map[string]*schema.Provider{
47+
"coder": provider.New(),
48+
},
49+
IsUnitTest: true,
50+
Steps: []resource.TestStep{{
51+
Config: mustReadFile(t, "../examples/data-sources/"+testDir+"/data-source.tf"),
52+
}},
53+
})
54+
})
55+
}
3556
}
3657

3758
func mustReadFile(t *testing.T, path string) string {

0 commit comments

Comments
 (0)
Please sign in to comment.