ansible/test/units/playbook
Alex Schultz 247e43b252
Fix IncludedFile equality check (#69524)
In the case of a free style strategy, it is possible to end up with
multiple hosts trying to include from the same role, however the tasks
being included may be different with the use of tasks_from.  Previously
if you had two hosts that were included the same role when the
process_include_results function tries to determine if a included needs
to be run on a specific host, it would end up merging two different
tasks into which ever one was processed first.

This change updates the equality check to also check if the task uuid
associated with the IncludedFile is the same. The previous check only
checked if the task's parent uuid was the same. This breaks down when
both includes have the same parent.

    - hosts: all
      strategy: free
      gather_facts: false
      tasks:
        - include_role:
            name: random_sleep
        - block:
          - name: set a fact (1)
            include_role:
              name: set_a_fact
              tasks_from: fact1.yml
          - name: set a fact (2)
            include_role:
              name: set_a_fact
              tasks_from: fact2.yml
        - name: include didn't run
          fail:
            msg: >
              set_a_fact didn't run
              fact1: {{ fact1 | default('not defined')}}
              fact2: {{ fact2 | default('not defined') }}"
          when: (fact1 is not defined or fact2 is not defined)

Closes #69521
2020-06-04 10:41:46 -05:00
..
role Remove empty setUp/tearDown/tearDownClass methods in test classes. 2019-11-06 08:14:29 -08:00
__init__.py
test_attribute.py Move unit test compat code out of lib/ansible/. (#46996) 2018-10-12 20:01:14 -07:00
test_base.py Replace TestCase.assertEquals with TestCase.assertEqual. 2019-11-11 10:24:21 -08:00
test_block.py Remove empty overridden unittest.setUp and unittest.tearDown methods. 2019-11-05 09:12:11 -08:00
test_collectionsearch.py Make sure collection is a list if a str is given (#69081) 2020-04-28 10:47:11 -05:00
test_conditional.py conditional: fix direct boolean "shortcut" (#47941) 2018-11-07 21:33:54 +01:00
test_helpers.py Make sure collection is a list if a str is given (#69081) 2020-04-28 10:47:11 -05:00
test_included_file.py Fix IncludedFile equality check (#69524) 2020-06-04 10:41:46 -05:00
test_play.py Remove empty overridden unittest.setUp and unittest.tearDown methods. 2019-11-05 09:12:11 -08:00
test_play_context.py Split test_play_context_make_become_cmd into files (#68026) 2020-03-04 22:26:04 -08:00
test_playbook.py Remove empty setUp/tearDown/tearDownClass methods in test classes. 2019-11-06 08:14:29 -08:00
test_taggable.py Allow tags to be templated from a variable (#49833) 2018-12-17 15:40:26 -06:00
test_task.py Replace TestCase.assertEquals with TestCase.assertEqual. 2019-11-11 10:24:21 -08:00