summaryrefslogtreecommitdiff
path: root/test/handler/test_tflint_handler.vader
diff options
context:
space:
mode:
authorJérôme Foray <moi@foray-jero.me>2019-10-07 21:14:22 +0200
committerw0rp <w0rp@users.noreply.github.com>2019-10-07 20:14:22 +0100
commitf9322113095ac01c00d4c38da6aca715663e35cf (patch)
tree531020ec6edc005bee0d10e4226402478702c36e /test/handler/test_tflint_handler.vader
parent6d888017897e5e1356f6232d91bc39926131bf5b (diff)
downloadale-f9322113095ac01c00d4c38da6aca715663e35cf.zip
fix tflint handler for 0.11+ (#2775)
* fix tflint handler for 0.11+ * fixup! fix tflint handler for 0.11+ * maintain compatibility with previous tflint output format * fixup! maintain compatibility with previous tflint output format * Add comment about tflint's output format accross versions
Diffstat (limited to 'test/handler/test_tflint_handler.vader')
-rw-r--r--test/handler/test_tflint_handler.vader70
1 files changed, 69 insertions, 1 deletions
diff --git a/test/handler/test_tflint_handler.vader b/test/handler/test_tflint_handler.vader
index 099d0926..6b8173af 100644
--- a/test/handler/test_tflint_handler.vader
+++ b/test/handler/test_tflint_handler.vader
@@ -4,7 +4,7 @@ Before:
After:
call ale#linter#Reset()
-Execute(The tflint handler should parse items correctly):
+Execute(The tflint handler should parse items correctly for pre 0.11):
AssertEqual
\ [
\ {
@@ -29,3 +29,71 @@ Execute(The tflint handler should parse items correctly):
\ ale_linters#terraform#tflint#Handle(123, [
\ '[ { "detector": "aws_db_instance_readable_password", "type": "WARNING", "message": "be warned, traveller", "line": 12, "file": "github.com/wata727/example-module/aws_db_instance.tf", "link": "https://github.com/wata727/tflint/blob/master/docs/aws_db_instance_readable_password.md" }, { "detector": "aws_elasticache_cluster_invalid_type", "type": "ERROR", "message": "error message", "line": 9, "file": "github.com/wata727/example-module/aws_elasticache_cluster.tf", "link": "https://github.com/wata727/tflint/blob/master/docs/aws_elasticache_cluster_invalid_type.md" }, { "detector": "aws_instance_not_specified_iam_profile", "type": "NOTICE", "message": "just so ya know", "line": 5, "file": "github.com/wata727/example-module/aws_instance.tf", "link": "https://github.com/wata727/tflint/blob/master/docs/aws_instance_not_specified_iam_profile.md" } ]'
\ ])
+
+Execute(The tflint handler should parse items correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'filename': 'github.com/wata727/example-module/aws_instance.tf',
+ \ 'lnum': 1,
+ \ 'col': 30,
+ \ 'end_lnum': 2,
+ \ 'end_col': 1,
+ \ 'text': 'A block definition must have block content delimited by "{" and "}", starting on the same line as the block header.',
+ \ 'code': 'Invalid block definition',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'filename': 'github.com/wata727/example-module/aws_instance.tf',
+ \ 'lnum': 2,
+ \ 'col': 3,
+ \ 'end_lnum': 2,
+ \ 'end_col': 6,
+ \ 'text': 'An argument named "ami" is not expected here.',
+ \ 'code': 'Unsupported argument',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'filename': 'github.com/wata727/example-module/aws_instance.tf',
+ \ 'lnum': 3,
+ \ 'col': 3,
+ \ 'end_lnum': 1,
+ \ 'end_col': 6,
+ \ 'text': 'An argument named "instance_type" is not expected here.',
+ \ 'code': 'Unsupported argument',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'filename': 'github.com/wata727/example-module/aws_db_instance.tf',
+ \ 'lnum': 12,
+ \ 'col': 11,
+ \ 'end_lnum': 12,
+ \ 'end_col': 21,
+ \ 'text': 'be warned, traveller',
+ \ 'code': 'aws_db_instance_readable_password',
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'filename': 'github.com/wata727/example-module/aws_elasticache_cluster.tf',
+ \ 'lnum': 9,
+ \ 'col': 29,
+ \ 'end_lnum': 9,
+ \ 'end_col': 29,
+ \ 'text': 'error message',
+ \ 'code': 'aws_elasticache_cluster_invalid_type',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'filename': 'github.com/wata727/example-module/aws_instance.tf',
+ \ 'lnum': 5,
+ \ 'col': 15,
+ \ 'end_lnum': 5,
+ \ 'end_col': 25,
+ \ 'text': 'just so ya know',
+ \ 'code': 'aws_instance_not_specified_iam_profile',
+ \ 'type': 'I',
+ \ },
+ \ ],
+ \ ale_linters#terraform#tflint#Handle(123, [
+ \ '{"issues":[{"rule":{"name":"aws_db_instance_readable_password","severity":"WARNING","link":"https://github.com/wata727/tflint/blob/master/docs/aws_db_instance_readable_password.md"},"message":"be warned, traveller","range":{"filename":"github.com/wata727/example-module/aws_db_instance.tf","start":{"line":12,"column":11},"end":{"line":12,"column":21},"callers":[]}},{"rule":{"name":"aws_elasticache_cluster_invalid_type","severity":"ERROR","link":"https://github.com/wata727/tflint/blob/master/docs/aws_elasticache_cluster_invalid_type.md"},"message":"error message","range":{"filename":"github.com/wata727/example-module/aws_elasticache_cluster.tf","start":{"line":9,"column":29},"end":{"line":9,"column":29},"callers":[]}},{"rule":{"name":"aws_instance_not_specified_iam_profile","severity":"NOTICE","link":"https://github.com/wata727/tflint/blob/master/docs/aws_instance_not_specified_iam_profile.md"},"message":"just so ya know","range":{"filename":"github.com/wata727/example-module/aws_instance.tf","start":{"line":5,"column":15},"end":{"line":5,"column":25},"callers":[]}}],"errors":[{"message":"github.com/wata727/example-module/aws_instance.tf:1,30-2,1: Invalid block definition; A block definition must have block content delimited by \"{\" and \"}\", starting on the same line as the block header."},{"message":"github.com/wata727/example-module/aws_instance.tf:2,3-6: Unsupported argument; An argument named \"ami\" is not expected here."},{"message":"github.com/wata727/example-module/aws_instance.tf:3,3-16: Unsupported argument; An argument named \"instance_type\" is not expected here."}]}'
+ \ ])