summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/ansible-test-sanity-yamllint
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/targets/ansible-test-sanity-yamllint')
-rw-r--r--test/integration/targets/ansible-test-sanity-yamllint/aliases4
-rw-r--r--test/integration/targets/ansible-test-sanity-yamllint/ansible_collections/ns/col/plugins/inventory/inventory1.py43
-rw-r--r--test/integration/targets/ansible-test-sanity-yamllint/ansible_collections/ns/col/plugins/modules/module1.py40
-rw-r--r--test/integration/targets/ansible-test-sanity-yamllint/expected.txt4
-rwxr-xr-xtest/integration/targets/ansible-test-sanity-yamllint/runme.sh11
5 files changed, 102 insertions, 0 deletions
diff --git a/test/integration/targets/ansible-test-sanity-yamllint/aliases b/test/integration/targets/ansible-test-sanity-yamllint/aliases
new file mode 100644
index 0000000..7741d44
--- /dev/null
+++ b/test/integration/targets/ansible-test-sanity-yamllint/aliases
@@ -0,0 +1,4 @@
+shippable/posix/group3 # runs in the distro test containers
+shippable/generic/group1 # runs in the default test container
+context/controller
+needs/target/collection
diff --git a/test/integration/targets/ansible-test-sanity-yamllint/ansible_collections/ns/col/plugins/inventory/inventory1.py b/test/integration/targets/ansible-test-sanity-yamllint/ansible_collections/ns/col/plugins/inventory/inventory1.py
new file mode 100644
index 0000000..b358e53
--- /dev/null
+++ b/test/integration/targets/ansible-test-sanity-yamllint/ansible_collections/ns/col/plugins/inventory/inventory1.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import annotations
+
+DOCUMENTATION = r"""
+---
+ module: module2
+ short_description: Hello test module
+ description: Hello test module.
+ options:
+ plugin:
+ required: true
+ description: name of the plugin (cache_host)
+ author:
+ - Ansible Core Team
+"""
+
+EXAMPLES = r"""
+---
+
+first_doc:
+some_key:
+
+---
+
+second_doc:
+some_key:
+
+"""
+
+RETURN = r"""
+---
+---
+"""
+
+from ansible.plugins.inventory import BaseInventoryPlugin
+
+
+class InventoryModule(BaseInventoryPlugin):
+
+ NAME = 'inventory1'
diff --git a/test/integration/targets/ansible-test-sanity-yamllint/ansible_collections/ns/col/plugins/modules/module1.py b/test/integration/targets/ansible-test-sanity-yamllint/ansible_collections/ns/col/plugins/modules/module1.py
new file mode 100644
index 0000000..14e7239
--- /dev/null
+++ b/test/integration/targets/ansible-test-sanity-yamllint/ansible_collections/ns/col/plugins/modules/module1.py
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import annotations
+
+DOCUMENTATION = r"""
+module: module1
+short_description: Hello test module
+description: Hello test module.
+options: {}
+author:
+ - Ansible Core Team
+short_description: Duplicate short description
+"""
+
+EXAMPLES = r"""
+- minimal:
+"""
+
+RETURN = r"""
+invalid_yaml:
+ bad_indent:
+ usual_indent:
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+
+
+def main():
+ module = AnsibleModule(
+ argument_spec={},
+ )
+
+ module.exit_json()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/test/integration/targets/ansible-test-sanity-yamllint/expected.txt b/test/integration/targets/ansible-test-sanity-yamllint/expected.txt
new file mode 100644
index 0000000..c9ba525
--- /dev/null
+++ b/test/integration/targets/ansible-test-sanity-yamllint/expected.txt
@@ -0,0 +1,4 @@
+plugins/inventory/inventory1.py:34:1: multiple-yaml-documents: RETURN: expected a single document in the stream
+plugins/modules/module1.py:15:1: key-duplicates: DOCUMENTATION: duplication of key "short_description" in mapping
+plugins/modules/module1.py:25:3: error: RETURN: syntax error: expected <block end>, but found '<block mapping start>' (syntax)
+plugins/modules/module1.py:25:3: unparsable-with-libyaml: RETURN: while parsing a block mapping - did not find expected key
diff --git a/test/integration/targets/ansible-test-sanity-yamllint/runme.sh b/test/integration/targets/ansible-test-sanity-yamllint/runme.sh
new file mode 100755
index 0000000..a333ccb
--- /dev/null
+++ b/test/integration/targets/ansible-test-sanity-yamllint/runme.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+set -eu
+
+source ../collection/setup.sh
+
+set -x
+
+ansible-test sanity --test yamllint --color --lint --failure-ok "${@}" > actual.txt
+
+diff -u "${TEST_DIR}/expected.txt" actual.txt