Skip to content

Commit

Permalink
fix: Fix include_role with loop
Browse files Browse the repository at this point in the history
  • Loading branch information
haidaraM committed Nov 9, 2021
1 parent 3fa8bea commit b607512
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/fixtures/include_role_with_loop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- hosts: all
tags:
- play2
tasks:
- name: Include with loop
include_role:
name: '{{ item }}'
loop:
- fake_role
- display_some_facts

14 changes: 14 additions & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ def test_include_role_parsing(grapher_cli: PlaybookGrapherCLI, display: Display)
assert len(include_role_2.tasks) == 3


@pytest.mark.parametrize('grapher_cli', [["include_role_with_loop.yml"]], indirect=True)
def test_include_role_with_loop_parsing(grapher_cli: PlaybookGrapherCLI, display: Display):
"""
Test parsing of include_role with loop
:param grapher_cli:
:param display:
:return:
"""
parser = PlaybookParser(grapher_cli.options.playbook_filename, display=display, include_role_tasks=True)
playbook_node = parser.parse()
assert len(playbook_node.plays) == 1
play_node = playbook_node.plays[0].destination


@pytest.mark.parametrize('grapher_cli', [["with_block.yml"]], indirect=True)
def test_block_parsing(grapher_cli: PlaybookGrapherCLI, display: Display):
"""
Expand Down

0 comments on commit b607512

Please sign in to comment.