Debian Codegraph @

test/integration/targets/module_utils_Ansible.ModuleUtils.Legacy/tasks/main.yml

raw
1 # NB: these tests are just a placeholder until we have pester unit tests.
2 # They are being run as part of the Windows smoke tests. Please do not significantly
3 # increase the size of these tests, as the smoke tests need to remain fast.
4 # Any significant additions should be made to the (as yet nonexistent) PS module_utils unit tests.
5 ---
6 - name: find a nonexistent drive letter
7 raw: foreach($c in [char[]]([char]'D'..[char]'Z')) { If (-not $(Get-PSDrive $c -ErrorAction SilentlyContinue)) { return $c } }
8 register: bogus_driveletter
9
10 - assert:
11 that: bogus_driveletter.stdout_lines[0] | length == 1
12
13 - name: test path shape validation
14 testpath:
15 path: "{{ item.path }}"
16 failed_when: path_shapes is failed != (item.should_fail | default(false))
17 register: path_shapes
18 with_items:
19 - path: C:\Windows
20 - path: HKLM:\Software
21 - path: '{{ bogus_driveletter.stdout_lines[0] }}:\goodpath'
22 - path: '{{ bogus_driveletter.stdout_lines[0] }}:\badpath*%@:\blar'
23 should_fail: true
24
25 - name: test list parameters
26 testlist:
27 value: '{{item.value}}'
28 register: list_tests
29 failed_when: list_tests is failed or list_tests.count != item.count
30 with_items:
31 - value: []
32 count: 0
33 - value:
34 - 1
35 - 2
36 count: 2
37 - value:
38 - 1
39 count: 1
40 - value: "1, 2"
41 count: 2