Skip to content

Commit e561457

Browse files
Merge pull request #63 from sophiegreen/master
Add IT for missing requests library
2 parents d8ea5ab + 1fd0cb9 commit e561457

File tree

5 files changed

+51
-8
lines changed

5 files changed

+51
-8
lines changed

build.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ echo "/* -----------------------------------------------------------------------
3939
echo "/* Integration tests for missing libraries Python 3.8 */"
4040
echo "/* -------------------------------------------------------------------------- */"
4141
(set -x; pip uninstall xmltodict -y)
42-
(set -x; ansible-test integration cics_cmci_missing_libraries --python 3.8)
42+
(set -x; ansible-test integration cics_cmci_missing_xmltodict_library --python 3.8)
43+
(set -x; pip install -r prod-requirements.txt)
44+
(set -x; pip uninstall requests -y)
45+
(set -x; ansible-test integration cics_cmci_missing_requests_library --python 3.8)
4346
(set -x; pip install -r prod-requirements.txt)
4447

4548
echo $?
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (c) IBM Corporation 2020
2+
# Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0)
3+
---
4+
- name: CMCI Integration Test
5+
collections:
6+
- ibm.ibm_zos_cics
7+
hosts: 'localhost'
8+
gather_facts: 'false'
9+
10+
tasks:
11+
- name: test missing requests library
12+
ibm.ibm_zos_cics.cmci_get:
13+
cmci_host: 'host'
14+
cmci_port: '12345'
15+
cmci_user: 'user'
16+
cmci_password: 'validpassword'
17+
insecure: true
18+
context: 'content'
19+
scope: 'scope'
20+
type: 'cicsprogram'
21+
failed_when: false
22+
register: result
23+
24+
- name: debug
25+
debug:
26+
msg: '{{ result.msg }}'
27+
28+
- name: assert
29+
assert:
30+
that:
31+
- 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" }}'

tests/integration/targets/cics_cmci_missing_libraries/runme.sh renamed to tests/integration/targets/cics_cmci_missing_requests_library/runme.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Copyright (c) IBM Corporation 2020
33
# Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0)
44
set -eux # This is important to ensure that return codes from failing tests are propagated
5-
ansible-playbook -e "@cmci-variables.yml" playbooks/cmci_missing_xmltodict.yml
5+
ansible-playbook playbooks/cmci_missing_requests.yml

tests/integration/targets/cics_cmci_missing_libraries/playbooks/cmci_missing_xmltodict.yml renamed to tests/integration/targets/cics_cmci_missing_xmltodict_library/playbooks/cmci_missing_xmltodict.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
tasks:
1111
- name: test missing xmltodict library
1212
ibm.ibm_zos_cics.cmci_get:
13-
cmci_host: '{{ cmci_host }}'
14-
cmci_port: '{{ cmci_port }}'
15-
cmci_user: '{{ cmci_user }}'
16-
cmci_password: '{{ cmci_password }}'
13+
cmci_host: 'host'
14+
cmci_port: '12345'
15+
cmci_user: 'user'
16+
cmci_password: 'validpassword'
1717
insecure: true
18-
context: '{{ context }}'
19-
scope: '{{ scope }}'
18+
context: 'content'
19+
scope: 'scope'
2020
type: 'cicsprogram'
2121
failed_when: false
2222
register: result
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
# Copyright (c) IBM Corporation 2020
3+
# Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0)
4+
set -eux # This is important to ensure that return codes from failing tests are propagated
5+
ansible-playbook playbooks/cmci_missing_xmltodict.yml

0 commit comments

Comments
 (0)