Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored import_playbook tests #951

Merged
merged 1 commit into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/TestImportPlaybook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Test ability to import playbooks."""
from ansiblelint.runner import Runner


def test_task_hook_import_playbook(default_rules_collection):
"""Assures import_playbook includes are recognized."""
playbook_path = 'test/playbook-import/playbook_parent.yml'
runner = Runner(default_rules_collection, playbook_path, [], [], [])
results = runner.run()

results_text = str(results)
assert len(runner.playbooks) == 2
assert len(results) == 2
# Assures we detected the issues from imported playbook
assert 'Commands should not change things' in results_text
assert '502' in results_text

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now 502 is expected

assert 'All tasks should be named' in results_text
20 changes: 0 additions & 20 deletions test/TestPretaskIncludePlaybook.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
connection: local
gather_facts: no
tasks:
- command: echo "no name" # noqa 502
- command: echo "no name" # should generate 502
ssbarnea marked this conversation as resolved.
Show resolved Hide resolved
- name: Another task
debug:
msg: debug message
3 changes: 3 additions & 0 deletions test/playbook-import/playbook_parent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- name: Importing another playbook
import_playbook: playbook_imported.yml
8 changes: 0 additions & 8 deletions test/playbook-include/playbook_post.yml

This file was deleted.

8 changes: 0 additions & 8 deletions test/playbook-include/playbook_pre.yml

This file was deleted.