Debian Codegraph @

ansible_collections/community/windows/tests/integration/targets/win_psmodule_info/tasks/common.yml

raw
1 # This file is part of Ansible
2
3 # Copyright: (c) 2020, Brian Scholer <@briantist>
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5 ---
6 - name: Assert that the correct structure is returned {{ suffix }}
7 assert:
8 that:
9 - module_info.modules is defined
10 - module_info.modules is sequence()
11 quiet: yes
12
13 - name: Assert that the correct number of modules are returned {{ suffix }}
14 assert:
15 that: module_info.modules | length >= expected_modules | length
16 fail_msg: >-
17 Expected {{ expected_modules | length }} modules, got {{ module_info.modules | map(attribute='name') | join(',') }} ({{ module_info.modules | length}})
18 quiet: yes
19
20 - name: Assert that all expected modules are present {{ suffix }}
21 assert:
22 that: item in (module_info.modules | map(attribute='name'))
23 fail_msg: "Expected module '{{ item }}' not found in results."
24 quiet: yes
25 loop: "{{ expected_modules }}"
26 loop_control:
27 label: "Assert '{{ item }}' in result."
28
29 - include_tasks: contains_all_fields.yml
30 vars:
31 dict_to_check: "{{ item }}"
32 loop: "{{
33 only_check_first
34 | default(True)
35 | bool
36 | ternary([ module_info.modules[0] ], module_info.modules)
37 }}"