Skip to content

Commit 54699bb

Browse files
authored
Fix E2E tests to take into account the newly added JSON fields (#454)
1 parent d7e76b5 commit 54699bb

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

integration/integration_test.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,23 @@ import (
1111
"github.com/google/go-cmp/cmp"
1212
)
1313

14+
type result struct {
15+
Issues []issue `json:"issues"`
16+
Errors []any `json:"errors"`
17+
}
18+
19+
type issue struct {
20+
Rule any `json:"rule"`
21+
Message any `json:"message"`
22+
Range any `json:"range"`
23+
Callers any `json:"callers"`
24+
25+
// The following fields are ignored because they are added in TFLint v0.59.1.
26+
// We can uncomment this once the minimum supported version is v0.59.1+.
27+
// Fixed any `json:"fixed"`
28+
// Fixable any `json:"fixable"`
29+
}
30+
1431
func TestIntegration(t *testing.T) {
1532
cases := []struct {
1633
Name string
@@ -43,12 +60,12 @@ func TestIntegration(t *testing.T) {
4360
t.Fatalf("Failed `%s`: %s", tc.Name, err)
4461
}
4562

46-
var expected interface{}
63+
var expected result
4764
if err := json.Unmarshal(ret, &expected); err != nil {
4865
t.Fatalf("Failed `%s`: %s", tc.Name, err)
4966
}
5067

51-
var got interface{}
68+
var got result
5269
if err := json.Unmarshal(stdout.Bytes(), &got); err != nil {
5370
t.Fatalf("Failed `%s`: %s", tc.Name, err)
5471
}

0 commit comments

Comments
 (0)