Skip to content

Commit 641d3f0

Browse files
authored
Fix E2E tests to take into account the newly added JSON fields (#421)
1 parent dea2a7b commit 641d3f0

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
@@ -20,6 +20,23 @@ type meta struct {
2020
Version string
2121
}
2222

23+
type result struct {
24+
Issues []issue `json:"issues"`
25+
Errors []any `json:"errors"`
26+
}
27+
28+
type issue struct {
29+
Rule any `json:"rule"`
30+
Message any `json:"message"`
31+
Range any `json:"range"`
32+
Callers any `json:"callers"`
33+
34+
// The following fields are ignored because they are added in TFLint v0.59.1.
35+
// We can uncomment this once the minimum supported version is v0.59.1+.
36+
// Fixed any `json:"fixed"`
37+
// Fixable any `json:"fixable"`
38+
}
39+
2340
func TestIntegration(t *testing.T) {
2441
cases := []struct {
2542
Name string
@@ -57,12 +74,12 @@ func TestIntegration(t *testing.T) {
5774
t.Fatalf("Failed `%s`: %s", tc.Name, err)
5875
}
5976

60-
var expected interface{}
77+
var expected result
6178
if err := json.Unmarshal(ret, &expected); err != nil {
6279
t.Fatalf("Failed `%s`: %s", tc.Name, err)
6380
}
6481

65-
var got interface{}
82+
var got result
6683
if err := json.Unmarshal(stdout.Bytes(), &got); err != nil {
6784
t.Fatalf("Failed `%s`: %s", tc.Name, err)
6885
}

0 commit comments

Comments
 (0)