summaryrefslogtreecommitdiff
path: root/test/handler/test_dockerfile_lint_handler.vader
diff options
context:
space:
mode:
authorBjorn Neergaard <bjorn@neersighted.com>2018-11-29 14:57:35 -0700
committerBjorn Neergaard <bjorn@neersighted.com>2018-11-29 14:57:35 -0700
commitd2b0ae8108b2ee395d4eb43c49d68b322a023a30 (patch)
treebb8145e69bf1bcb8968b29cb1a68c47ceb83674d /test/handler/test_dockerfile_lint_handler.vader
parentef641dda80f45cb979bc93c2513c6e10cbd8e42a (diff)
parent0a384a49d371838903d8401c5358ec60f3f4266d (diff)
downloadale-d2b0ae8108b2ee395d4eb43c49d68b322a023a30.zip
Merge branch 'master' into sridhars
Diffstat (limited to 'test/handler/test_dockerfile_lint_handler.vader')
-rw-r--r--test/handler/test_dockerfile_lint_handler.vader108
1 files changed, 108 insertions, 0 deletions
diff --git a/test/handler/test_dockerfile_lint_handler.vader b/test/handler/test_dockerfile_lint_handler.vader
new file mode 100644
index 00000000..619b7bde
--- /dev/null
+++ b/test/handler/test_dockerfile_lint_handler.vader
@@ -0,0 +1,108 @@
+Before:
+ runtime ale_linters/dockerfile/dockerfile_lint.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The dockerfile_lint handler should handle broken JSON):
+ AssertEqual
+ \ [],
+ \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), ["{asdf"])
+
+Execute(The dockerfile_lint handler should handle an empty string response):
+ AssertEqual
+ \ [],
+ \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), [])
+
+Execute(The dockerfile_lint handler should handle an empty result, even if it shouldn't happen):
+ AssertEqual
+ \ [],
+ \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), ["{}"])
+
+Execute(The dockerfile_lint handler should handle a normal example):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': -1,
+ \ 'type': 'E',
+ \ 'text': "Required LABEL name/key 'Name' is not defined",
+ \ },
+ \ {
+ \ 'lnum': -1,
+ \ 'type': 'E',
+ \ 'text': "Required LABEL name/key 'Version' is not defined",
+ \ },
+ \ {
+ \ 'lnum': 3,
+ \ 'type': 'I',
+ \ 'text': "the MAINTAINER command is deprecated. MAINTAINER is deprecated in favor of using LABEL since Docker v1.13.0",
+ \ },
+ \ {
+ \ 'lnum': -1,
+ \ 'type': 'I',
+ \ 'text': "There is no 'CMD' instruction",
+ \ },
+ \ ],
+ \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), [
+ \ '{',
+ \ ' "error": {',
+ \ ' "count": 2,',
+ \ ' "data": [',
+ \ ' {',
+ \ " \"message\": \"Required LABEL name/key 'Name' is not defined\",",
+ \ ' "line": -1,',
+ \ ' "level": "error",',
+ \ ' "lineContent": "",',
+ \ ' "reference_url": [',
+ \ ' "http://docs.projectatomic.io/container-best-practices/#",',
+ \ ' "_recommended_labels_for_your_project"',
+ \ ' ]',
+ \ ' },',
+ \ ' {',
+ \ " \"message\": \"Required LABEL name/key 'Version' is not defined\",",
+ \ ' "line": -1,',
+ \ ' "level": "error",',
+ \ ' "lineContent": "",',
+ \ ' "reference_url": [',
+ \ ' "http://docs.projectatomic.io/container-best-practices/#",',
+ \ ' "_recommended_labels_for_your_project"',
+ \ ' ]',
+ \ ' }',
+ \ ' ]',
+ \ ' },',
+ \ ' "warn": {',
+ \ ' "count": 0,',
+ \ ' "data": []',
+ \ ' },',
+ \ ' "info": {',
+ \ ' "count": 2,',
+ \ ' "data": [',
+ \ ' {',
+ \ ' "label": "maintainer_deprecated",',
+ \ ' "regex": {},',
+ \ ' "level": "info",',
+ \ ' "message": "the MAINTAINER command is deprecated",',
+ \ ' "description": "MAINTAINER is deprecated in favor of using LABEL since Docker v1.13.0",',
+ \ ' "reference_url": [',
+ \ ' "https://github.com/docker/cli/blob/master/docs/deprecated.md",',
+ \ ' "#maintainer-in-dockerfile"',
+ \ ' ],',
+ \ ' "lineContent": "MAINTAINER Alexander Olofsson <ace@haxalot.com>",',
+ \ ' "line": 3',
+ \ ' },',
+ \ ' {',
+ \ ' "instruction": "CMD",',
+ \ ' "count": 1,',
+ \ ' "level": "info",',
+ \ " \"message\": \"There is no 'CMD' instruction\",",
+ \ ' "description": "None",',
+ \ ' "reference_url": [',
+ \ ' "https://docs.docker.com/engine/reference/builder/",',
+ \ ' "#cmd"',
+ \ ' ]',
+ \ ' }',
+ \ ' ]',
+ \ ' },',
+ \ ' "summary": []',
+ \ '}',
+ \ ])