mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
3.5 KiB
YAML
105 lines
3.5 KiB
YAML
---
|
|
- name: Run Pester test(s) specifying a fake test file
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}\fakefile.ps1'
|
|
register: fake_file
|
|
failed_when: '"Cannot find file or directory: ''" + test_win_pester_path + "\\fakefile.ps1'' as it does not exist" not in fake_file.msg'
|
|
|
|
- name: Run Pester test(s) specifying a fake folder
|
|
win_pester:
|
|
path: '{{test_win_pester_path }}\fakedir'
|
|
register: fake_folder
|
|
failed_when: '"Cannot find file or directory: ''" + test_win_pester_path + "\\fakedir'' as it does not exist" not in fake_folder.msg'
|
|
|
|
- name: Run Pester test(s) specifying a test file and a higher pester version
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}\test01.test.ps1'
|
|
minimum_version: '6.0.0'
|
|
register: invalid_version
|
|
failed_when: '"Pester version is not greater or equal to 6.0.0" not in invalid_version.msg'
|
|
|
|
- name: Run Pester test(s) specifying a test file
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}\test01.test.ps1'
|
|
register: file_result
|
|
|
|
- name: assert Run Pester test(s) specify a test file
|
|
assert:
|
|
that:
|
|
- file_result.changed
|
|
- not file_result.failed
|
|
- file_result.output.TotalCount == 1
|
|
|
|
- name: Run Pester test(s) specifying a test file and with a minimum mandatory Pester version
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}\test01.test.ps1'
|
|
minimum_version: 3.0.0
|
|
register: file_result_with_version
|
|
|
|
- name: assert Run Pester test(s) specifying a test file and a minimum mandatory Pester version
|
|
assert:
|
|
that:
|
|
- file_result_with_version.changed
|
|
- not file_result_with_version.failed
|
|
- file_result_with_version.output.TotalCount == 1
|
|
|
|
- name: Run Pester test(s) located in a folder. Folder path end with '\'
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}\'
|
|
register: dir_with_ending_slash
|
|
|
|
- name: assert Run Pester test(s) located in a folder. Folder path end with '\'
|
|
assert:
|
|
that:
|
|
- dir_with_ending_slash.changed
|
|
- not dir_with_ending_slash.failed
|
|
- dir_with_ending_slash.output.TotalCount == 4
|
|
|
|
- name: Run Pester test(s) located in a folder. Folder path does not end with '\'
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}'
|
|
register: dir_without_ending_slash
|
|
|
|
- name: assert Run Pester test(s) located in a folder. Folder does not end with '\'
|
|
assert:
|
|
that:
|
|
- dir_without_ending_slash.changed
|
|
- not dir_without_ending_slash.failed
|
|
- dir_without_ending_slash.output.TotalCount == 4
|
|
|
|
- name: Run Pester test(s) located in a folder and with a minimum mandatory Pester version
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}'
|
|
minimum_version: 3.0.0
|
|
register: dir_with_version
|
|
|
|
- name: assert Run Pester test(s) located in a folder and with a minimum mandatory Pester version
|
|
assert:
|
|
that:
|
|
- dir_with_version.changed
|
|
- not dir_with_version.failed
|
|
- dir_with_version.output.TotalCount == 4
|
|
|
|
- name: Run Pester test(s) specifying a test file without specifying tag
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}\test03.test.ps1'
|
|
register: test_no_tag
|
|
|
|
- name: assert Run Pester test(s) specifying a test file and all tests executed
|
|
assert:
|
|
that:
|
|
- test_no_tag.changed
|
|
- test_no_tag.output.TotalCount == 2
|
|
|
|
- name: Run Pester test(s) specifying a test file with tag
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}\test03.test.ps1'
|
|
tags: tag1
|
|
register: test_with_tag
|
|
|
|
- name: Run Pester test(s) specifying a test file and only test with sepecified tag executed
|
|
assert:
|
|
that:
|
|
- test_with_tag.changed
|
|
- test_with_tag.output.TotalCount == 1
|