summaryrefslogtreecommitdiff
path: root/test/integration/targets/win_module_utils/tasks/main.yml
blob: 38873fdb412000ab1267eade27c5fbdb09236374 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
- name: call old WANTS_JSON module
  legacy_only_old_way:
  register: old_way

- assert:
    that:
    - old_way.data == 'success'

- name: call module with only legacy requires
  legacy_only_new_way:
  register: new_way

- assert:
    that:
    - new_way.data == 'success'

- name: call old WANTS_JSON module with windows line endings
  legacy_only_old_way_win_line_ending:
  register: old_way_win

- assert:
    that:
    - old_way_win.data == 'success'

- name: call module with only legacy requires and windows line endings
  legacy_only_new_way_win_line_ending:
  register: new_way_win

- assert:
    that:
    - new_way_win.data == 'success'

- name: call module with local module_utils
  uses_local_utils:
  register: local_utils

- assert:
    that:
    - local_utils.data == "ValueFromCustomFunction"

- name: call module that imports bogus Ansible-named module_utils
  uses_bogus_utils:
  ignore_errors: true
  register: bogus_utils

- assert:
    that:
    - bogus_utils is failed
    - bogus_utils.msg is search("Could not find")

- name: call module that imports module_utils with further imports
  recursive_requires:
  register: recursive_requires
  vars:
    # Our coverage runner does not work with recursive required. This is a limitation on PowerShell so we need to
    # disable coverage for this task
    _ansible_coverage_remote_output: ''

- assert:
    that:
    - 'recursive_requires.value == "Get-Test3: 2: Get-Test2, 1: Get-Test1, 3: Get-NewTest3"'

- name: call module with camel conversion tests
  camel_conversion_test:
  register: camel_conversion

- assert:
    that:
    - camel_conversion.data == 'success'

- block:
  - name: create test user with well know SID as the name
    win_user:
      name: S-1-0-0
      password: AbcDef123!@#
      state: present

  - name: call module with SID tests
    sid_utils_test:
      sid_account: S-1-0-0
    register: sid_test

  always:
  - name: remove test SID user
    win_user:
      name: S-1-0-0
      state: absent

- assert:
    that:
    - sid_test.data == 'success'

- name: create temp testing folder
  win_file:
    path: C:\ansible testing
    state: directory

- name: download binary the outputs argv to stdout
  win_get_url:
    url: https://ansible-ci-files.s3.amazonaws.com/test/integration/roles/test_win_module_utils/PrintArgv.exe
    dest: C:\ansible testing\PrintArgv.exe

- name: call module with CommandUtil tests
  command_util_test:
    exe: C:\ansible testing\PrintArgv.exe
  register: command_util

- assert:
    that:
    - command_util.data == 'success'

- name: call module with ArgvParser tests
  argv_parser_test:
    exe: C:\ansible testing\PrintArgv.exe
  register: argv_test

- assert:
    that:
    - argv_test.data == 'success'

- name: call module with symbolic link tests
  symbolic_link_test:
  register: symbolic_link

- assert:
    that:
    - symbolic_link.data == 'success'

- name: remove testing folder
  win_file:
    path: C:\ansible testing
    state: absent

- name: call module with FileUtil tests
  file_util_test:
  register: file_util_test

- assert:
    that:
    - file_util_test.data == 'success'

- name: call module with PrivilegeUtil tests
  privilege_util_test:
  register: privilege_util_test

- assert:
    that:
    - privilege_util_test.data == 'success'

- name: call module with C# reference
  csharp_util:
  register: csharp_res

- name: assert call module with C# reference
  assert:
    that:
    - not csharp_res is failed
    - csharp_res.res == '{"a":"a","b":1}'

- name: call module with AddType tests
  add_type_test:
  register: add_type_test

- name: assert call module with AddType tests
  assert:
    that:
    - not add_type_test is failed
    - add_type_test.res == 'success'

- name: call module with BackupFile tests
  backup_file_test:
  register: backup_file_test

- name: assert call module with BackupFile tests
  assert:
    that:
    - not backup_file_test is failed
    - backup_file_test.res == 'success'