@@ -2,7 +2,6 @@ package provider_test
2
2
3
3
import (
4
4
"os"
5
- "path/filepath"
6
5
"testing"
7
6
8
7
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
@@ -12,34 +11,28 @@ import (
12
11
"github.com/coder/terraform-provider-coder/provider"
13
12
)
14
13
15
- func TestExamples_CoderParameter (t * testing.T ) {
14
+ func TestExamples (t * testing.T ) {
16
15
t .Parallel ()
17
16
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
- })
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
+ }
43
36
}
44
37
45
38
func mustReadFile (t * testing.T , path string ) string {
0 commit comments