@@ -2,6 +2,7 @@ package provider_test
2
2
3
3
import (
4
4
"os"
5
+ "path/filepath"
5
6
"testing"
6
7
7
8
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
@@ -11,28 +12,34 @@ import (
11
12
"github.com/coder/terraform-provider-coder/provider"
12
13
)
13
14
14
- func TestExamples (t * testing.T ) {
15
+ func TestExamples_CoderParameter (t * testing.T ) {
15
16
t .Parallel ()
16
17
17
- for _ , testDir := range []string {
18
- "coder_parameter" ,
19
- "coder_workspace_tags" ,
20
- } {
21
- t .Run (testDir , func (t * testing.T ) {
22
- testDir := testDir
23
- t .Parallel ()
24
-
25
- resource .Test (t , resource.TestCase {
26
- Providers : map [string ]* schema.Provider {
27
- "coder" : provider .New (),
28
- },
29
- IsUnitTest : true ,
30
- Steps : []resource.TestStep {{
31
- Config : mustReadFile (t , "../examples/resources/" + testDir + "/resource.tf" ),
32
- }},
33
- })
34
- })
35
- }
18
+ resource .Test (t , resource.TestCase {
19
+ Providers : map [string ]* schema.Provider {
20
+ "coder" : provider .New (),
21
+ },
22
+ IsUnitTest : true ,
23
+ Steps : []resource.TestStep {{
24
+ Config : mustReadFile (t , "../examples/resources/coder_workspace_tags/resource.tf" ),
25
+ }},
26
+ })
27
+ }
28
+
29
+ func TestExamples_CoderWorkspaceTags (t * testing.T ) {
30
+ // no parallel as the test calls t.Setenv()
31
+ workDir := "../examples/resources/coder_workspace_tags"
32
+ t .Setenv (provider .TerraformWorkDirEnv , workDir )
33
+
34
+ resource .Test (t , resource.TestCase {
35
+ Providers : map [string ]* schema.Provider {
36
+ "coder" : provider .New (),
37
+ },
38
+ IsUnitTest : true ,
39
+ Steps : []resource.TestStep {{
40
+ Config : mustReadFile (t , filepath .Join (workDir , "/resource.tf" )),
41
+ }},
42
+ })
36
43
}
37
44
38
45
func mustReadFile (t * testing.T , path string ) string {
0 commit comments