summaryrefslogtreecommitdiff
path: root/test/integration/targets/yum
diff options
context:
space:
mode:
authorAbhijeet Kasurde <akasurde@redhat.com>2018-01-09 16:58:55 +0530
committerMartin Krizek <martin.krizek@gmail.com>2018-01-09 12:28:55 +0100
commitb14c8b130fa16ce75704bf784bdf7264c43dbaaa (patch)
tree13e419ff470ca8eb34751dfdd3c86fa48691dd02 /test/integration/targets/yum
parent9c7d9873957dac46090cf36006c495a810ebf5b7 (diff)
downloadansible-b14c8b130fa16ce75704bf784bdf7264c43dbaaa.tar.gz
yum: handle exception in local_envra (#34400)
This fix adds rpm.error exception which is raised when API unable to get envra information from RPM package. Also, adds integration test for local_envra method. Fixes: #30074 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Diffstat (limited to 'test/integration/targets/yum')
-rw-r--r--test/integration/targets/yum/tasks/yum.yml24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/integration/targets/yum/tasks/yum.yml b/test/integration/targets/yum/tasks/yum.yml
index 9c09638bbc..224e299230 100644
--- a/test/integration/targets/yum/tasks/yum.yml
+++ b/test/integration/targets/yum/tasks/yum.yml
@@ -557,3 +557,27 @@
- "'msg' in yum_result"
- "'rc' in yum_result"
- "'results' in yum_result"
+
+- name: Create a temp RPM file which does not contain nevra information
+ file:
+ name: "/tmp/non_existent_pkg.rpm"
+ state: touch
+
+- name: Try installing RPM file which does not contain nevra information
+ yum:
+ name: "/tmp/non_existent_pkg.rpm"
+ state: present
+ register: no_nevra_info_result
+ ignore_errors: yes
+
+- name: Verify RPM failed to install
+ assert:
+ that:
+ - "'changed' in no_nevra_info_result"
+ - "'msg' in no_nevra_info_result"
+ - "'Failed to get nevra information from RPM package' in no_nevra_info_result.msg"
+
+- name: Delete a temp RPM file
+ file:
+ name: "/tmp/non_existent_pkg.rpm"
+ state: absent