Skip to content

Commit

Permalink
Fix win_dsc integration tests (#670)
Browse files Browse the repository at this point in the history
  • Loading branch information
ronger4 authored Nov 19, 2024
1 parent d991d91 commit 62a75e7
Show file tree
Hide file tree
Showing 3 changed files with 396 additions and 374 deletions.
5 changes: 4 additions & 1 deletion tests/integration/targets/win_dsc/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
dependencies:
- setup_remote_tmp_dir
- setup_remote_tmp_dir
galaxy_info:
role_name: win_dsc
namespace: win_dsc_ns
58 changes: 30 additions & 28 deletions tests/integration/targets/win_dsc/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
---
- block:
- name: add remote temp dir to PSModulePath
win_path:
name: PSModulePath
state: present
scope: machine
elements:
- '{{ remote_tmp_dir }}'
- name: Win_dsc test flow
block:
- name: Add remote temp dir to PSModulePath
ansible.windows.win_path:
name: PSModulePath
state: present
scope: machine
elements:
- '{{ remote_tmp_dir }}'

# Needed so subsequent SSH session see the new PSModulePath env var
- name: restart sshd service
win_service:
name: sshd
state: restarted
when: ansible_connection == 'ssh'
# Needed so subsequent SSH session see the new PSModulePath env var
- name: Restart sshd service
ansible.windows.win_service:
name: sshd
state: restarted
when: ansible_connection == 'ssh'

- meta: reset_connection
- name: Reset connection meta
ansible.builtin.meta: reset_connection

- name: copy custom DSC resources to remote temp dir
win_copy:
src: files/
dest: '{{ remote_tmp_dir }}'
- name: Copy custom DSC resources to remote temp dir
ansible.windows.win_copy:
src: files/
dest: '{{ remote_tmp_dir }}'

- name: run tests
include_tasks: tests.yml
- name: Run tests
ansible.builtin.include_tasks: tests.yml

always:
- name: remove remote tmp dir from PSModulePath
win_path:
name: PSModulePath
state: absent
scope: machine
elements:
- '{{ remote_tmp_dir }}'
- name: Remove remote tmp dir from PSModulePath
ansible.windows.win_path:
name: PSModulePath
state: absent
scope: machine
elements:
- '{{ remote_tmp_dir }}'
Loading

0 comments on commit 62a75e7

Please sign in to comment.