summaryrefslogtreecommitdiffstats
path: root/test/TestLocalContent.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:04:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:04:50 +0000
commit782f8df6e41f29dce2db4970a3ad84aaeb7d8c5f (patch)
tree3a88a542cd8074743d251881131510157cfc510b /test/TestLocalContent.py
parentInitial commit. (diff)
downloadansible-lint-upstream/4.3.7.tar.xz
ansible-lint-upstream/4.3.7.zip
Adding upstream version 4.3.7.upstream/4.3.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/TestLocalContent.py')
-rw-r--r--test/TestLocalContent.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/TestLocalContent.py b/test/TestLocalContent.py
new file mode 100644
index 0000000..e78aab4
--- /dev/null
+++ b/test/TestLocalContent.py
@@ -0,0 +1,42 @@
+"""Test playbooks with local content."""
+import pytest
+
+from ansiblelint.runner import Runner
+
+
+def test_local_collection(default_rules_collection):
+ """Assures local collections are found."""
+ playbook_path = 'test/local-content/test-collection.yml'
+ runner = Runner(default_rules_collection, playbook_path, [], [], [])
+ results = runner.run()
+
+ assert len(runner.playbooks) == 1
+ assert len(results) == 0
+
+
+def test_roles_local_content(default_rules_collection):
+ """Assures local content in roles is found."""
+ playbook_path = 'test/local-content/test-roles-success/test.yml'
+ runner = Runner(default_rules_collection, playbook_path, [], [], [])
+ results = runner.run()
+
+ assert len(runner.playbooks) == 4
+ assert len(results) == 0
+
+
+def test_roles_local_content_failure(default_rules_collection):
+ """Assures local content in roles is found, even if Ansible itself has trouble."""
+ playbook_path = 'test/local-content/test-roles-failed/test.yml'
+ runner = Runner(default_rules_collection, playbook_path, [], [], [])
+ results = runner.run()
+
+ assert len(runner.playbooks) == 4
+ assert len(results) == 0
+
+
+def test_roles_local_content_failure_complete(default_rules_collection):
+ """Role with local content that is not found."""
+ playbook_path = 'test/local-content/test-roles-failed-complete/test.yml'
+ runner = Runner(default_rules_collection, playbook_path, [], [], [])
+ with pytest.raises(SystemExit, match="^3$"):
+ runner.run()