Debian Codegraph @

test/integration/targets/powershell_module_utils/tasks/main.yml

raw
1 - name: call old WANTS_JSON module
2 legacy_only_old_way:
3 register: old_way
4
5 - assert:
6 that:
7 - old_way.data == 'success'
8
9 - name: call module with only legacy requires
10 legacy_only_new_way:
11 register: new_way
12
13 - assert:
14 that:
15 - new_way.data == 'success'
16
17 - name: call old WANTS_JSON module with windows line endings
18 legacy_only_old_way_win_line_ending:
19 register: old_way_win
20
21 - assert:
22 that:
23 - old_way_win.data == 'success'
24
25 - name: call module with only legacy requires and windows line endings
26 legacy_only_new_way_win_line_ending:
27 register: new_way_win
28
29 - assert:
30 that:
31 - new_way_win.data == 'success'
32
33 - name: call module with local module_utils
34 uses_local_utils:
35 register: local_utils
36
37 - assert:
38 that:
39 - local_utils.data == "ValueFromCustomFunction"
40
41 - name: call module that imports bogus Ansible-named module_utils
42 uses_bogus_utils:
43 ignore_errors: true
44 register: bogus_utils
45
46 - assert:
47 that:
48 - bogus_utils is failed
49 - bogus_utils.msg is search("Could not find")
50
51 - name: call module that imports module_utils with further imports
52 recursive_requires:
53 register: recursive_requires
54 vars:
55 # Our coverage runner does not work with recursive required. This is a limitation on PowerShell so we need to
56 # disable coverage for this task
57 _ansible_coverage_remote_output: ''
58
59 - assert:
60 that:
61 - 'recursive_requires.value == "Get-Test3: 2: Get-Test2, 1: Get-Test1, 3: Get-NewTest3"'
62
63 - name: call module with C# reference
64 csharp_util:
65 register: csharp_res
66
67 - name: assert call module with C# reference
68 assert:
69 that:
70 - not csharp_res is failed
71 - csharp_res.res == '{"a":"a","b":1}'