2018-04-06 12:48:45 +02:00
|
|
|
---
|
2019-11-15 04:53:30 +01:00
|
|
|
- name: create test folder(s)
|
2018-04-17 07:24:54 +02:00
|
|
|
win_file:
|
2019-11-15 04:53:30 +01:00
|
|
|
path: '{{test_win_pester_path}}\{{item}}'
|
2018-04-17 07:24:54 +02:00
|
|
|
state: directory
|
2019-11-15 04:53:30 +01:00
|
|
|
with_items:
|
|
|
|
- Modules
|
|
|
|
- Tests
|
2018-04-17 07:24:54 +02:00
|
|
|
|
|
|
|
- name: download Pester module from S3 bucket
|
|
|
|
win_get_url:
|
|
|
|
# this was downloaded straight off the Pester GitHub release page and uploaded to the S3 bucket
|
|
|
|
# https://github.com/pester/Pester/releases
|
2019-05-15 02:50:56 +02:00
|
|
|
url: 'https://ansible-ci-files.s3.amazonaws.com/test/integration/roles/test_win_pester/Pester-4.3.1.zip'
|
2018-04-17 07:24:54 +02:00
|
|
|
dest: '{{test_win_pester_path}}\Pester-4.3.1.zip'
|
|
|
|
|
|
|
|
- name: unzip Pester module
|
|
|
|
win_unzip:
|
|
|
|
src: '{{test_win_pester_path}}\Pester-4.3.1.zip'
|
|
|
|
dest: '{{test_win_pester_path}}\Modules'
|
|
|
|
|
|
|
|
- name: rename extracted zip to match module name
|
|
|
|
win_shell: Rename-Item -Path '{{test_win_pester_path}}\Modules\Pester-4.3.1' -NewName Pester
|
|
|
|
|
|
|
|
- name: add custom Pester location to the PSModulePath
|
|
|
|
win_path:
|
|
|
|
name: PSModulePath
|
|
|
|
scope: machine
|
2018-04-06 12:48:45 +02:00
|
|
|
state: present
|
2018-04-17 07:24:54 +02:00
|
|
|
elements:
|
|
|
|
- '{{test_win_pester_path}}\Modules'
|
2018-04-06 12:48:45 +02:00
|
|
|
|
2018-04-17 07:24:54 +02:00
|
|
|
- name: copy test files
|
2018-04-06 12:48:45 +02:00
|
|
|
win_copy:
|
2018-04-17 07:24:54 +02:00
|
|
|
src: files/
|
2019-11-15 04:53:30 +01:00
|
|
|
dest: '{{test_win_pester_path}}\Tests'
|
2018-04-17 07:24:54 +02:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: run Pester tests
|
|
|
|
include_tasks: test.yml
|
2019-11-15 04:53:30 +01:00
|
|
|
vars:
|
|
|
|
test_path: '{{ test_win_pester_path }}\Tests'
|
2018-04-17 07:24:54 +02:00
|
|
|
|
|
|
|
always:
|
|
|
|
- name: remove custom pester location on the PSModulePath
|
|
|
|
win_path:
|
|
|
|
name: PSModulePath
|
|
|
|
scope: machine
|
|
|
|
state: absent
|
|
|
|
elements:
|
|
|
|
- '{{test_win_pester_path}}\Modules'
|
2019-11-15 04:53:30 +01:00
|
|
|
|
2018-04-17 07:24:54 +02:00
|
|
|
- name: delete test folder
|
|
|
|
win_file:
|
|
|
|
path: '{{test_win_pester_path}}'
|
|
|
|
state: absent
|