|
1 | 1 | package rules |
2 | 2 |
|
3 | | -import ( |
4 | | - "testing" |
5 | | - |
6 | | - hcl "github.com/hashicorp/hcl/v2" |
7 | | - "github.com/terraform-linters/tflint-plugin-sdk/helper" |
8 | | -) |
9 | | - |
10 | | -func Test_AwsInstanceExampleType(t *testing.T) { |
11 | | - tests := []struct { |
12 | | - Name string |
13 | | - Content string |
14 | | - Expected helper.Issues |
15 | | - }{ |
16 | | - { |
17 | | - Name: "issue found", |
18 | | - Content: ` |
19 | | -resource "aws_instance" "web" { |
20 | | - instance_type = "t2.micro" |
21 | | -}`, |
22 | | - Expected: helper.Issues{ |
23 | | - { |
24 | | - Rule: NewAwsInstanceExampleTypeRule(), |
25 | | - Message: "instance type is t2.micro", |
26 | | - Range: hcl.Range{ |
27 | | - Filename: "resource.tf", |
28 | | - Start: hcl.Pos{Line: 3, Column: 21}, |
29 | | - End: hcl.Pos{Line: 3, Column: 31}, |
30 | | - }, |
31 | | - }, |
32 | | - }, |
33 | | - }, |
34 | | - } |
35 | | - |
36 | | - rule := NewAwsInstanceExampleTypeRule() |
37 | | - |
38 | | - for _, test := range tests { |
39 | | - t.Run(test.Name, func(t *testing.T) { |
40 | | - runner := helper.TestRunner(t, map[string]string{"resource.tf": test.Content}) |
41 | | - |
42 | | - if err := rule.Check(runner); err != nil { |
43 | | - t.Fatalf("Unexpected error occurred: %s", err) |
44 | | - } |
45 | | - |
46 | | - helper.AssertIssues(t, test.Expected, runner.Issues) |
47 | | - }) |
48 | | - } |
49 | | -} |
| 3 | +// |
| 4 | +//import ( |
| 5 | +// "testing" |
| 6 | +// |
| 7 | +// hcl "github.com/hashicorp/hcl/v2" |
| 8 | +// "github.com/terraform-linters/tflint-plugin-sdk/helper" |
| 9 | +//) |
| 10 | +// |
| 11 | +//func Test_AwsInstanceExampleType(t *testing.T) { |
| 12 | +// tests := []struct { |
| 13 | +// Name string |
| 14 | +// Content string |
| 15 | +// Expected helper.Issues |
| 16 | +// }{ |
| 17 | +// { |
| 18 | +// Name: "issue found", |
| 19 | +// Content: ` |
| 20 | +//resource "aws_instance" "web" { |
| 21 | +// instance_type = "t2.micro" |
| 22 | +//}`, |
| 23 | +// Expected: helper.Issues{ |
| 24 | +// { |
| 25 | +// Rule: NewAwsInstanceExampleTypeRule(), |
| 26 | +// Message: "instance type is t2.micro", |
| 27 | +// Range: hcl.Range{ |
| 28 | +// Filename: "resource.tf", |
| 29 | +// Start: hcl.Pos{Line: 3, Column: 21}, |
| 30 | +// End: hcl.Pos{Line: 3, Column: 31}, |
| 31 | +// }, |
| 32 | +// }, |
| 33 | +// }, |
| 34 | +// }, |
| 35 | +// } |
| 36 | +// |
| 37 | +// rule := NewAwsInstanceExampleTypeRule() |
| 38 | +// |
| 39 | +// for _, test := range tests { |
| 40 | +// t.Run(test.Name, func(t *testing.T) { |
| 41 | +// runner := helper.TestRunner(t, map[string]string{"resource.tf": test.Content}) |
| 42 | +// |
| 43 | +// if err := rule.Check(runner); err != nil { |
| 44 | +// t.Fatalf("Unexpected error occurred: %s", err) |
| 45 | +// } |
| 46 | +// |
| 47 | +// helper.AssertIssues(t, test.Expected, runner.Issues) |
| 48 | +// }) |
| 49 | +// } |
| 50 | +//} |
0 commit comments