Skip to content

Commit 6b94b30

Browse files
Fixes for integration tests on Python 2.7
Signed-off-by: Stew Francis <[email protected]>
1 parent dde5313 commit 6b94b30

File tree

5 files changed

+22
-41
lines changed

5 files changed

+22
-41
lines changed

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@
55
collections:
66
- ibm.ibm_zos_cics
77
hosts: 'localhost'
8-
gather_facts: 'false'
8+
gather_facts: 'true'
99
vars:
1010
http_port: 28953
1111
http_scope: IYCWEMW1
12+
python_2_message: >-
13+
Error performing CMCI request{{ ':' }} ('Connection aborted.',
14+
BadStatusLine('No status line received - the server has closed the
15+
connection',))
16+
python_3_message: >-
17+
Error performing CMCI request{{ ':' }} ('Connection aborted.',
18+
RemoteDisconnected('Remote end closed connection without response'))
19+
error_message: "{{ python_2_message if ansible_python.version.major == 2 else python_3_message }}"
1220

1321
tasks:
1422
- name: test https with incorrect scheme
@@ -30,12 +38,15 @@
3038
debug:
3139
msg: '{{ result.msg }}'
3240

41+
- name: debug https
42+
debug:
43+
msg: '{{ error_message }}'
44+
3345
- name: assert https
3446
assert:
3547
that:
3648
- result.failed is false
37-
- result.msg == "Error performing CMCI request: (\"Connection aborted.\",
38-
RemoteDisconnected(\"Remote end closed connection without response\"))"
49+
- result.msg == error_message
3950

4051

4152
- name: test http with incorrect scheme
@@ -61,5 +72,4 @@
6172
assert:
6273
that:
6374
- result.failed is false
64-
- result.msg == "Error performing CMCI request: (\"Connection aborted.\",
65-
RemoteDisconnected(\"Remote end closed connection without response\"))"
75+
- result.msg[:79] == 'Error performing CMCI request{{ ":" }} [SSL{{ ":" }} WRONG_VERSION_NUMBER] wrong version number'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
- name: debug
2525
debug:
26-
msg: '{{ result.msg }}'
26+
msg: '{{ result }}'
2727

2828
- name: assert
2929
assert:

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

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
hosts: 'localhost'
88
gather_facts: 'false'
99

10+
vars:
11+
fail_message: "CMCI request returned non-OK status{{':'}} Unauthorized"
12+
1013
tasks:
1114
- name: test incorrect username
1215
ibm.ibm_zos_cics.cmci_get:
@@ -31,30 +34,4 @@
3134
- result.failed is false
3235
- result.http_status_code == 401
3336
- result.http_status == "Unauthorized"
34-
- result.msg == "CMCI request returned non-OK status: Unauthorized"
35-
36-
37-
- name: test incorrect password
38-
ibm.ibm_zos_cics.cmci_get:
39-
cmci_host: '{{ cmci_host }}'
40-
cmci_port: '{{ cmci_port }}'
41-
cmci_user: '{{ cmci_user }}'
42-
cmci_password: 'wrongpassword123!'
43-
insecure: true
44-
context: '{{ context }}'
45-
scope: '{{ scope }}'
46-
type: 'cicsprogram'
47-
failed_when: false
48-
register: result
49-
50-
- name: debug
51-
debug:
52-
msg: '{{ result.msg }}'
53-
54-
- name: assert incorrect password
55-
assert:
56-
that:
57-
- result.failed is false
58-
- result.http_status_code == 401
59-
- result.http_status == "Unauthorized"
60-
- result.msg == "CMCI request returned non-OK status: Unauthorized"
37+
- result.msg == fail_message

tests/integration/targets/cics_cmci_missing_requests_library/playbooks/cmci_missing_requests.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,4 @@
2929
assert:
3030
that:
3131
- result.failed is false
32-
- '{{ result.msg[:59] == "Failed to import the required Python library (requests) on " }}'
33-
- '{{ result.msg[-232:] == "Please read the module documentation and install it in the appropriate location.
34-
If the required library is installed, but Ansible is using the wrong Python interpreter, please
35-
consult the documentation on ansible_python_interpreter" }}'
32+
- '{{ result.msg[:59] == "Failed to import the required Python library (requests) on " }}'

tests/integration/targets/cics_cmci_missing_xmltodict_library/playbooks/cmci_missing_xmltodict.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,4 @@
2929
assert:
3030
that:
3131
- result.failed is false
32-
- '{{ result.msg[:58] == "Failed to import the required Python library (encoder) on " }}'
33-
- '{{ result.msg[-232:] == "Please read the module documentation and install it in the appropriate location.
34-
If the required library is installed, but Ansible is using the wrong Python interpreter, please
35-
consult the documentation on ansible_python_interpreter" }}'
32+
- '{{ result.msg[:58] == "Failed to import the required Python library (encoder) on " }}'

0 commit comments

Comments
 (0)