Skip to content

Commit bcedec2

Browse files
committed
fail_on_nodata integration tests
Signed-off-by: Andrew Twydell <[email protected]>
1 parent 69018a4 commit bcedec2

17 files changed

+336
-88
lines changed

tests/integration/targets/cics_cmci/cmci-variables.yml.template

100644100755
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ cmci_secure_port: 28951
77
cmci_user: __user__
88
cmci_password: __password__
99
cmci_context: CICSEX56
10-
cmci_scope: IYCWEMW2
10+
cmci_scope_https: IYCWEMW2
11+
cmci_scope_http: IYCWEMW1
12+
cmci_scope_alternate_1: IYCWEML1
13+
cmci_scope_alternate_2: IYCWEMM1

tests/integration/targets/cics_cmci/playbooks/cics_cmci_http.yml

100644100755
Lines changed: 143 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
collections:
66
- ibm.ibm_zos_cics
77
hosts: 'localhost'
8-
gather_facts: 'false'
8+
gather_facts: false
99
vars:
1010
csdgroup: 'HTTPTEST'
1111
program: 'HTTPTEST'
12-
http_scope: IYCWEMW1
12+
program_2: 'HTTPTES2'
13+
program_filter: 'HTTPTES*'
1314

1415
module_defaults:
1516
ibm.ibm_zos_cics.cmci_get:
@@ -18,7 +19,7 @@
1819
cmci_user: '{{ cmci_user }}'
1920
cmci_password: '{{ cmci_password }}'
2021
context: '{{ cmci_context }}'
21-
scope: '{{ http_scope }}'
22+
scope: '{{ cmci_scope_http }}'
2223
insecure: true
2324
scheme: 'http'
2425

@@ -29,7 +30,7 @@
2930
cmci_user: '{{ cmci_user }}'
3031
cmci_password: '{{ cmci_password }}'
3132
context: '{{ cmci_context }}'
32-
scope: '{{ http_scope }}'
33+
scope: '{{ cmci_scope_http }}'
3334
insecure: true
3435
scheme: 'http'
3536

@@ -40,7 +41,7 @@
4041
cmci_user: '{{ cmci_user }}'
4142
cmci_password: '{{ cmci_password }}'
4243
context: '{{ cmci_context }}'
43-
scope: '{{ http_scope }}'
44+
scope: '{{ cmci_scope_http }}'
4445
insecure: true
4546
scheme: 'http'
4647

@@ -51,7 +52,7 @@
5152
cmci_user: '{{ cmci_user }}'
5253
cmci_password: '{{ cmci_password }}'
5354
context: '{{ cmci_context }}'
54-
scope: '{{ http_scope }}'
55+
scope: '{{ cmci_scope_http }}'
5556
insecure: true
5657
scheme: 'http'
5758

@@ -62,7 +63,7 @@
6263
cmci_user: '{{ cmci_user }}'
6364
cmci_password: '{{ cmci_password }}'
6465
context: '{{ cmci_context }}'
65-
scope: '{{ http_scope }}'
66+
scope: '{{ cmci_scope_http }}'
6667
insecure: true
6768
scheme: 'http'
6869

@@ -169,9 +170,6 @@
169170
- result.record_count == 1
170171
- result.records[0].program == program
171172

172-
- name: debug 1
173-
debug:
174-
msg: "{{ result }}"
175173

176174
- name: 'HTTP Disable program'
177175
delegate_to: 'localhost'
@@ -194,13 +192,8 @@
194192
- attribute: 'USECOUNT'
195193
operator: 'LT'
196194
value: '1'
197-
198195
register: result
199196

200-
- name: debug 2
201-
debug:
202-
msg: "{{ result }}"
203-
204197
- name: assert 5
205198
assert:
206199
that:
@@ -227,6 +220,68 @@
227220
- result.cpsm_response == 'OK'
228221
- result.record_count == 1
229222
- result.success_count == 1
223+
224+
225+
- name: 'HTTP Create progdef 2'
226+
delegate_to: 'localhost'
227+
ibm.ibm_zos_cics.cmci_create:
228+
type: 'CICSDefinitionProgram'
229+
attributes:
230+
name: '{{ program_2 }}'
231+
csdgroup: '{{ csdgroup }}'
232+
create_parameters:
233+
- name: 'CSD'
234+
register: result
235+
236+
- name: assert program_2 created
237+
assert:
238+
that:
239+
- result is changed
240+
- result.cpsm_response == 'OK'
241+
- result.record_count == 1
242+
- result.records[0].name == program_2
243+
244+
245+
- name: 'HTTP Check All Records Returned'
246+
delegate_to: 'localhost'
247+
ibm.ibm_zos_cics.cmci_get:
248+
type: 'CICSDefinitionProgram'
249+
resources:
250+
filter:
251+
name: '{{ program_filter }}'
252+
get_parameters:
253+
- name: 'CSDGROUP'
254+
value: '{{ csdgroup }}'
255+
register: result
256+
257+
- name: assert record_count is 2
258+
assert:
259+
that:
260+
- result is not changed
261+
- result.cpsm_response == 'OK'
262+
- result.record_count == 2
263+
264+
265+
- name: 'HTTP Check record count attribute'
266+
delegate_to: 'localhost'
267+
ibm.ibm_zos_cics.cmci_get:
268+
type: 'CICSDefinitionProgram'
269+
record_count: 1
270+
resources:
271+
filter:
272+
name: '{{ program_filter }}'
273+
get_parameters:
274+
- name: 'CSDGROUP'
275+
value: '{{ csdgroup }}'
276+
register: result
277+
278+
- name: assert record_count attribute
279+
assert:
280+
that:
281+
- result is not changed
282+
- result.cpsm_response == 'OK'
283+
- result.record_count == 2
284+
- result.records|length == 1
230285

231286

232287
- name: 'HTTP Delete progdef'
@@ -247,4 +302,76 @@
247302
- result is changed
248303
- result.cpsm_response == 'OK'
249304
- result.record_count == 1
250-
- result.success_count == 1
305+
- result.success_count == 1
306+
307+
308+
- name: 'HTTP Delete progdef2'
309+
delegate_to: 'localhost'
310+
ibm.ibm_zos_cics.cmci_delete:
311+
type: 'CICSDefinitionProgram'
312+
resources:
313+
filter:
314+
NAME: '{{ program_2 }}'
315+
get_parameters:
316+
- name: 'CSDGROUP'
317+
value: '{{ csdgroup }}'
318+
register: result
319+
320+
- name: assert program_2 deleted
321+
assert:
322+
that:
323+
- result is changed
324+
- result.cpsm_response == 'OK'
325+
- result.record_count == 1
326+
- result.success_count == 1
327+
328+
329+
- name: 'HTTP fail_on_nodata default'
330+
delegate_to: 'localhost'
331+
ibm.ibm_zos_cics.cmci_get:
332+
type: 'CICSDefinitionProgram'
333+
resources:
334+
filter:
335+
name: '{{ program_filter }}'
336+
get_parameters:
337+
- name: 'CSDGROUP'
338+
value: '{{ csdgroup }}'
339+
register: result
340+
failed_when: >
341+
'cpsm_response_code' not in result or result.cpsm_response_code not in [1024, 1027]
342+
343+
- name: assert fail_on_nodata attribute default
344+
assert:
345+
that:
346+
- result is not changed
347+
- result.failed == false
348+
- result.cpsm_response == 'NODATA'
349+
- result.cpsm_response_code == 1027
350+
- result.record_count == 0
351+
- result.msg is defined
352+
- result.failed_when_result is defined
353+
354+
355+
- name: 'HTTP fail_on_nodata'
356+
delegate_to: 'localhost'
357+
ibm.ibm_zos_cics.cmci_get:
358+
type: 'CICSDefinitionProgram'
359+
fail_on_nodata: False
360+
resources:
361+
filter:
362+
name: '{{ program_filter }}'
363+
get_parameters:
364+
- name: 'CSDGROUP'
365+
value: '{{ csdgroup }}'
366+
register: result
367+
368+
- name: assert fail_on_nodata attribute false
369+
assert:
370+
that:
371+
- result is not changed
372+
- result.failed == false
373+
- result.cpsm_response == 'NODATA'
374+
- result.cpsm_response_code == 1027
375+
- result.record_count == 0
376+
- result.msg is not defined
377+
- result.failed_when_result is not defined

0 commit comments

Comments
 (0)