summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2021-02-02 13:08:18 +0900
committerGitHub <noreply@github.com>2021-02-02 13:08:18 +0900
commit9b5c09047361f3ec2cf18afbb6d1e03047a59778 (patch)
tree13ab27fe9a41dd16c78091ac34ec22728b310990 /test
parentc747c277c2ead915b56be0f7e25a9f0c8b91b78e (diff)
parentd9b74caf43ed2bfeb3f090a18fe8b17fe5438c3f (diff)
downloadale-9b5c09047361f3ec2cf18afbb6d1e03047a59778.zip
Merge pull request #3472 from m-ildefons/hadolint
hadolint: Recognize message type
Diffstat (limited to 'test')
-rw-r--r--test/handler/test_hadolint.vader49
-rw-r--r--test/test_dockerfile_hadolint_linter.vader4
2 files changed, 51 insertions, 2 deletions
diff --git a/test/handler/test_hadolint.vader b/test/handler/test_hadolint.vader
new file mode 100644
index 00000000..eec71fbc
--- /dev/null
+++ b/test/handler/test_hadolint.vader
@@ -0,0 +1,49 @@
+Before:
+ runtime ale_linters/dockerfile/hadolint.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The hadolint handler should handle an empty string response):
+ AssertEqual
+ \ [],
+ \ ale_linters#dockerfile#hadolint#Handle(bufnr(''), [])
+
+Execute(The hadolint handler should handle a normal example):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'col': 0,
+ \ 'type': 'W',
+ \ 'text': "Always tag the version of an image explicitly",
+ \ 'detail': "DL3006 ( https://github.com/hadolint/hadolint/wiki/DL3006 )\n\nAlways tag the version of an image explicitly",
+ \ },
+# \ {
+# \ 'lnum': 2,
+# \ 'col': 0,
+# \ 'type': 'E',
+# \ 'text': "MAINTAINER is deprecated",
+# \ 'detail': "DL4000 ( https://github.com/hadolint/hadolint/wiki/DL4000 )\n\nMAINTAINER is deprecated",
+# \ },
+# \ {
+# \ 'lnum': 4,
+# \ 'col': 0,
+# \ 'type': 'W',
+# \ 'text': "Specify version with `yum install -y <package>-<version>`.",
+# \ 'detail': "DL3033 ( https://github.com/hadolint/hadolint/wiki/DL3033 )\n\nSpecify version with `yum install -y <package>-<version>`.",
+# \ },
+# \ {
+# \ 'lnum': 12,
+# \ 'col': 0,
+# \ 'type': 'W',
+# \ 'text': "In POSIX sh, brace expansion is undefined.",
+# \ 'detail': "SC2039 ( https://github.com/koalaman/shellcheck/wiki/SC2039 )\n\nIn POSIX sh, brace expansion is undefined.",
+# \ },
+ \ ],
+ \ ale_linters#dockerfile#hadolint#Handle(bufnr(''), [
+ \ '/dev/stdin:1 DL3006 warning: Always tag the version of an image explicitly',
+# \ '/dev/stdin:2 DL4000 error: MAINTAINER is deprecated',
+# \ '/dev/stdin:4 DL3033 warning: Specify version with `yum install -y <package>-<version>`.',
+# \ '/dev/stdin:12 SC2039 warning: In POSIX sh, brace expansion is undefined.'
+ \ ])
diff --git a/test/test_dockerfile_hadolint_linter.vader b/test/test_dockerfile_hadolint_linter.vader
index 3edbb2b6..882e1a6c 100644
--- a/test/test_dockerfile_hadolint_linter.vader
+++ b/test/test_dockerfile_hadolint_linter.vader
@@ -70,14 +70,14 @@ Execute(test warnings from hadolint):
AssertEqual
\ [{'lnum': 10, 'col': 0, 'type': 'W', 'text': 'Using latest is prone to errors', 'detail': "DL3007 ( https://github.com/hadolint/hadolint/wiki/DL3007 )\n\nUsing latest is prone to errors"}],
\ ale_linters#dockerfile#hadolint#Handle(bufnr(''), [
- \ '/dev/stdin:10 DL3007 Using latest is prone to errors',
+ \ '/dev/stdin:10 DL3007 warning: Using latest is prone to errors',
\ ])
Execute(test warnings from shellcheck):
AssertEqual
\ [{'lnum': 3, 'col': 0, 'type': 'W', 'text': 'bar is referenced but not assigned.', 'detail': "SC2154 ( https://github.com/koalaman/shellcheck/wiki/SC2154 )\n\nbar is referenced but not assigned."}],
\ ale_linters#dockerfile#hadolint#Handle(bufnr(''), [
- \ '/dev/stdin:3 SC2154 bar is referenced but not assigned.',
+ \ '/dev/stdin:3 SC2154 warning: bar is referenced but not assigned.',
\ ])
Execute(test errors from dockerfile parser):