Skip to content

Commit 43b29dd

Browse files
committed
Update bundle failure IT so that it fails on install
1 parent 698e400 commit 43b29dd

File tree

1 file changed

+102
-14
lines changed

1 file changed

+102
-14
lines changed

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

Lines changed: 102 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,123 @@
66
- ibm.ibm_zos_cics
77
hosts: 'localhost'
88
gather_facts: 'false'
9+
vars:
10+
csdgroup: 'ANSITEST'
11+
bunddef: 'ANSIBUND'
12+
13+
module_defaults:
14+
ibm.ibm_zos_cics.cmci_delete:
15+
cmci_host: '{{ cmci_host }}'
16+
cmci_port: '{{ cmci_port }}'
17+
cmci_user: '{{ cmci_user }}'
18+
cmci_password: '{{ cmci_password }}'
19+
context: '{{ context }}'
20+
scope: '{{ scope }}'
21+
insecure: true
22+
23+
ibm.ibm_zos_cics.cmci_action:
24+
cmci_host: '{{ cmci_host }}'
25+
cmci_port: '{{ cmci_port }}'
26+
cmci_user: '{{ cmci_user }}'
27+
cmci_password: '{{ cmci_password }}'
28+
context: '{{ context }}'
29+
scope: '{{ scope }}'
30+
insecure: true
31+
32+
ibm.ibm_zos_cics.cmci_create:
33+
cmci_host: '{{ cmci_host }}'
34+
cmci_port: '{{ cmci_port }}'
35+
cmci_user: '{{ cmci_user }}'
36+
cmci_password: '{{ cmci_password }}'
37+
context: '{{ context }}'
38+
scope: '{{ scope }}'
39+
insecure: true
40+
941

1042
tasks:
11-
- name: test create bundle failure
43+
- name: 'delete bundle def'
44+
delegate_to: 'localhost'
45+
ibm.ibm_zos_cics.cmci_delete:
46+
type: 'CICSDefinitionBundle'
47+
resources:
48+
complex_filter:
49+
and:
50+
- attribute: NAME
51+
value: '{{ bunddef }}'
52+
- attribute: CSDGROUP
53+
value: '{{ csdgroup }}'
54+
get_parameters:
55+
- name: 'CSDGROUP'
56+
value: '{{ csdgroup }}'
57+
register: result
58+
failed_when: >
59+
'cpsm_response' not in result or result.cpsm_response not in ['OK', 'NODATA']
60+
61+
62+
- name: 'create bundle def'
63+
delegate_to: 'localhost'
1264
ibm.ibm_zos_cics.cmci_create:
13-
cmci_host: '{{ cmci_host }}'
14-
cmci_port: '{{ cmci_port }}'
15-
cmci_user: '{{ cmci_user }}'
16-
cmci_password: '{{ cmci_password }}'
17-
insecure: true
18-
context: '{{ context }}'
19-
scope: '{{ scope }}'
2065
type: 'CICSDefinitionBundle'
2166
create_parameters:
2267
- name: 'CSD'
2368
attributes:
24-
name: 'ANSIBUND'
25-
csdgroup: 'ANDITEST'
26-
bundledir: "invalid"
69+
name: '{{ bunddef }}'
70+
csdgroup: '{{ csdgroup }}'
71+
bundledir: "/invalid"
72+
register: result
73+
74+
- name: assert created
75+
assert:
76+
that:
77+
- result is changed
78+
- result.cpsm_response == 'OK'
79+
- result.record_count == 1
80+
- result.records[0].name == 'ANSIBUND'
81+
82+
- name: 'install bundle def'
83+
delegate_to: 'localhost'
84+
ibm.ibm_zos_cics.cmci_action:
85+
type: 'CICSDefinitionBundle'
86+
action_name: 'CSDINSTALL'
87+
resources:
88+
filter:
89+
NAME: '{{ bunddef }}'
90+
get_parameters:
91+
- name: 'CSDGROUP'
92+
value: '{{ csdgroup }}'
2793
failed_when: false
2894
register: result
2995

3096
- name: debug
3197
debug:
3298
msg: '{{ result }}'
3399

34-
- name: assert
100+
- name: assert installed
35101
assert:
36102
that:
37103
- result.failed is false
38104
# This will need updating when we pull out more specific error messages from the CMCI response.
39-
# Expecting the error to contain 'Attribute Bundle Directory (BUNDLEDIR) Error(BUNDDEF_INV_DATA)'
40-
- result.msg == "CMCI request failed with response \"TABLEERROR\" reason \"DATAERROR\""
105+
# Expecting the error to contain 'EXEC CICS command(CSD INSTALL) RESP(INVREQ) RESP2(633)'
106+
# Where RESP2(633) is 'Installation of BUNDLE resource resource failed because the resource had no manifest'
107+
- result.msg == "CMCI request failed with response \"TABLEERROR\" reason \"DATAERROR\""
108+
109+
110+
- name: 'delete bundle def'
111+
delegate_to: 'localhost'
112+
ibm.ibm_zos_cics.cmci_delete:
113+
type: 'CICSDefinitionBundle'
114+
resources:
115+
filter:
116+
NAME: '{{ bunddef }}'
117+
get_parameters:
118+
- name: 'CSDGROUP'
119+
value: '{{ csdgroup }}'
120+
register: result
121+
122+
- name: assert deleted
123+
assert:
124+
that:
125+
- result is changed
126+
- result.cpsm_response == 'OK'
127+
- result.record_count == 1
128+
- result.success_count == 1

0 commit comments

Comments
 (0)