From 4b7b28fe531d8722f14de27a44613575009c8cdf Mon Sep 17 00:00:00 2001 From: James Page Date: Mon, 20 Feb 2023 15:45:17 +0000 Subject: [PATCH] Redirected mqsc_file in playbooks, modified main.py Test playbooks run successfully (apart from test_web_console; separate issue), as they are directed to use MQSC files from /var/mqm/. main.py is modified to provide feedback on which tests failed and clean up appropriately. --- .../ibm/ibmmq/tests/playbooks/main.py | 25 +++++++++++++++++-- .../ibm/ibmmq/tests/playbooks/test_misc.yml | 2 +- .../tests/playbooks/test_present_qmgr.yml | 2 +- .../tests/playbooks/test_running_qmgr.yml | 4 +-- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/ansible_collections/ibm/ibmmq/tests/playbooks/main.py b/ansible_collections/ibm/ibmmq/tests/playbooks/main.py index f8c2457..848addd 100644 --- a/ansible_collections/ibm/ibmmq/tests/playbooks/main.py +++ b/ansible_collections/ibm/ibmmq/tests/playbooks/main.py @@ -21,18 +21,39 @@ if rc.returncode == 0: print("<---- All Tests Completed Successfully ---->") else: - print("<---- cleanup_test.yml failed ---->") + print("<---- FATAL: cleanup_test.yml failed ---->") else: + rc = subprocess.run(['ansible-playbook', '--inventory', 'inventory.ini', 'cleanup_test.yml']) print("<---- test_web_console.yml failed ---->") + if rc.returncode != 0: + print("<---- FATAL: cleanup_test.yml failed ---->") else: + rc = subprocess.run(['ansible-playbook', '--inventory', 'inventory.ini', 'cleanup_test.yml']) print("<---- test_misc.yml failed ---->") + if rc.returncode != 0: + print("<---- FATAL: cleanup_test.yml failed ---->") else: + rc = subprocess.run(['ansible-playbook', '--inventory', 'inventory.ini', 'cleanup_test.yml']) print("<---- test_running_qmgr.yml failed ---->") + if rc.returncode != 0: + print("<---- FATAL: cleanup_test.yml failed ---->") else: + rc = subprocess.run(['ansible-playbook', '--inventory', 'inventory.ini', 'cleanup_test.yml']) print("<---- test_present_qmgr.yml failed ---->") + if rc.returncode != 0: + print("<---- FATAL: cleanup_test.yml failed ---->") else: + rc = subprocess.run(['ansible-playbook', '--inventory', 'inventory.ini', 'cleanup_test.yml']) print("<---- test_absent_qmgr.yml failed ---->") + if rc.returncode != 0: + print("<---- FATAL: cleanup_test.yml failed ---->") else: + rc = subprocess.run(['ansible-playbook', '--inventory', 'inventory.ini', 'cleanup_test.yml']) print("<---- setup_test.yml failed ---->") + if rc.returncode != 0: + print("<---- FATAL: cleanup_test.yml failed ---->") else: - print("<---- test_install.yml failed ---->") \ No newline at end of file + rc = subprocess.run(['ansible-playbook', '--inventory', 'inventory.ini', 'cleanup_test.yml']) + print("<---- test_install.yml failed ---->") + if rc.returncode != 0: + print("<---- FATAL: cleanup_test.yml failed ---->") \ No newline at end of file diff --git a/ansible_collections/ibm/ibmmq/tests/playbooks/test_misc.yml b/ansible_collections/ibm/ibmmq/tests/playbooks/test_misc.yml index 69ed565..981b594 100644 --- a/ansible_collections/ibm/ibmmq/tests/playbooks/test_misc.yml +++ b/ansible_collections/ibm/ibmmq/tests/playbooks/test_misc.yml @@ -88,7 +88,7 @@ queue_manager: qmname: qm1_misc_2 state: running - mqsc_file: mqsc_display + mqsc_file: '/var/mqm/mqsc_display' register: testout_1 failed_when: False - name: dump run output diff --git a/ansible_collections/ibm/ibmmq/tests/playbooks/test_present_qmgr.yml b/ansible_collections/ibm/ibmmq/tests/playbooks/test_present_qmgr.yml index 7bc8197..35d723f 100644 --- a/ansible_collections/ibm/ibmmq/tests/playbooks/test_present_qmgr.yml +++ b/ansible_collections/ibm/ibmmq/tests/playbooks/test_present_qmgr.yml @@ -65,7 +65,7 @@ queue_manager: qmname: 'qm1_present_mqsc' state: 'present' - mqsc_file: mq-dev-config.mqsc + mqsc_file: '/var/mqm/mq-dev-config.mqsc' register: testout_3 failed_when: False - name: dump test output diff --git a/ansible_collections/ibm/ibmmq/tests/playbooks/test_running_qmgr.yml b/ansible_collections/ibm/ibmmq/tests/playbooks/test_running_qmgr.yml index 7b84872..60985fd 100644 --- a/ansible_collections/ibm/ibmmq/tests/playbooks/test_running_qmgr.yml +++ b/ansible_collections/ibm/ibmmq/tests/playbooks/test_running_qmgr.yml @@ -19,7 +19,7 @@ queue_manager: qmname: 'qm1_running' state: 'present' - mqsc_file: mqsc_display + mqsc_file: '/var/mqm/mqsc_display' register: testout failed_when: False - name: dump test output @@ -36,7 +36,7 @@ queue_manager: qmname: 'qm1_running' state: 'running' - mqsc_file: mqsc_display + mqsc_file: '/var/mqm/mqsc_display' register: testout failed_when: False - name: dump test output