Skip to content

Commit

Permalink
Add ansible-ansiblelint tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sifus committed Jan 15, 2021
1 parent 2f7ac18 commit accffc6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/flycheck-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -3102,6 +3102,22 @@ evaluating BODY."
'( 6 4 warning "variable \"Name\" is not referenced" :checker ada-gnat)
'(8 11 warning "unrecognized pragma \"Foo\"" :checker ada-gnat)))

(flycheck-ert-def-checker-test ansible-ansiblelint ansible errors
(flycheck-ert-should-syntax-check
"language/ansible/error.yml" 'yaml-mode
'(3 nil error "(conflicting action statements: debug, command)"
:checker ansible-ansiblelint)))

(flycheck-ert-def-checker-test ansible-ansiblelint ansible warnings
(flycheck-ert-should-syntax-check
"language/ansible/warnings.yml" 'yaml-mode
'(5 nil warning "Commands should not change things if nothing needs doing"
:checker ansible-ansiblelint)
'(5 nil warning "service used in place of service module"
:checker ansible-ansiblelint)
'(9 nil warning "variables should have spaces before and after: {{ varname }}"
:checker ansible-ansiblelint)))

(flycheck-ert-def-checker-test asciidoc asciidoc nil
(let ((flycheck-disabled-checkers '(asciidoctor)))
(flycheck-ert-should-syntax-check
Expand Down
11 changes: 11 additions & 0 deletions test/resources/language/ansible/error.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- hosts: localhost
tasks:
- name: foo
debug:
msg: bar
command: echo
# On this file ansible-playbook --syntax-check reports:
# ERROR! conflicting action statements: debug, command
#
# The error appears to be in 'test/conflicting_action.yml': line 3, column 7, but may
# be elsewhere in the file depending on the exact syntax problem.
9 changes: 9 additions & 0 deletions test/resources/language/ansible/warnings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- hosts: bobbins

tasks:
- name: a bad play
action: command service blah restart

- name: incorrect brackets
file: "{{space}}"

0 comments on commit accffc6

Please sign in to comment.