mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-08 17:34:01 -07:00
Added module win_pester and relatives integration tests (#37343)
* Added module win_pester and relatives integration tests * Corrected issues as stated by ansible-test * Added defaults variable in integration tests * Added task to install Pester if needed in the integration test * Corrected error in win_psmodule task * Added Pester installation with Chocolatey when Powershell version < 5 * Get facts... * Disabled invoke-pester output * Added pester_result type * Added jhawkesworth changes proposal * Corrected documentation linting * Corrected linting * Added dagwieers recommendations * Added dagwieers recommendations * Corrected linting errors and task error in integration test * Corrected error in integration test * Added dagwieers recommendations * Corrected requirements in the DOCUMENTATION block
This commit is contained in:
parent
fc7a68875a
commit
49aac5f8c7
7 changed files with 313 additions and 0 deletions
68
lib/ansible/modules/windows/win_pester.py
Normal file
68
lib/ansible/modules/windows/win_pester.py
Normal file
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright: (c) 2018, Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
||||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: win_pester
|
||||
short_description: Run Pester tests on Windows hosts
|
||||
version_added: "2.6"
|
||||
description:
|
||||
- Run Pester tests on Windows hosts.
|
||||
- Test files have to be available on the remote host.
|
||||
requirements:
|
||||
- Pester
|
||||
options:
|
||||
path:
|
||||
description:
|
||||
- Path to a pester test file or a folder where tests can be found.
|
||||
- If the path is a folder, the module will consider all ps1 files as Pester tests.
|
||||
required: true
|
||||
version:
|
||||
description:
|
||||
- Minimum version of the pester module that has to be available on the remote host.
|
||||
author:
|
||||
- Erwan Quelin (@erwanquelin)
|
||||
'''
|
||||
|
||||
RETURN = r'''
|
||||
pester_version:
|
||||
description: Version of the pester module found on the remote host.
|
||||
returned: always
|
||||
type: string
|
||||
sample: 4.3.1
|
||||
output:
|
||||
description: Results of the Pester tests.
|
||||
returned: success
|
||||
type: list
|
||||
sample: False
|
||||
'''
|
||||
|
||||
EXAMPLES = r'''
|
||||
- name: Get facts
|
||||
setup:
|
||||
|
||||
- name: Add Pester module
|
||||
action:
|
||||
module_name: "{{ 'win_psmodule' if ansible_powershell_version >= 5 else 'win_chocolatey' }}"
|
||||
name: Pester
|
||||
state: present
|
||||
|
||||
- name: Run the pester test provided in the path parameter.
|
||||
win_pester:
|
||||
path: C:\Pester
|
||||
|
||||
# Run pesters tests files that are present in the specified folder
|
||||
# ensure that the pester module version available is greater or equal to the version parameter.
|
||||
- name: Run the pester test present in a folder and check the Pester module version.
|
||||
win_pester:
|
||||
path: C:\Pester\test01.test.ps1
|
||||
version: 4.1.0
|
||||
'''
|
Loading…
Add table
Add a link
Reference in a new issue