From 08bffbcbaa230d77b6c55fbe05232091cd61eddc Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Thu, 5 Oct 2017 15:25:45 +0200 Subject: [PATCH] yum: add integration tests for installing from URL (#30616) --- test/integration/targets/yum/tasks/yum.yml | 89 +++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) diff --git a/test/integration/targets/yum/tasks/yum.yml b/test/integration/targets/yum/tasks/yum.yml index 2b99dcfbfcc..961b6189d89 100644 --- a/test/integration/targets/yum/tasks/yum.yml +++ b/test/integration/targets/yum/tasks/yum.yml @@ -20,7 +20,7 @@ check_mode: true register: yum_result -- name: verify no change on re-uninstall in check mdoe +- name: verify no change on re-uninstall in check mode assert: that: - "not yum_result.changed" @@ -470,3 +470,90 @@ - "yum_result.rc == 1" - "not yum_result.changed" - "yum_result|failed" + +# setup for testing installing an RPM from url + +- set_fact: + pkg_name: fpaste + +- name: cleanup + yum: + name: "{{ pkg_name }}" + state: absent + +- set_fact: + pkg_url: http://download.fedoraproject.org/pub/epel/7/x86_64/f/fpaste-0.3.7.4.1-1.el7.noarch.rpm +# setup end + +- name: download an rpm + get_url: + url: "{{ pkg_url }}" + dest: "/tmp/{{ pkg_name }}.rpm" + +- name: install the downloaded rpm + yum: + name: "/tmp/{{ pkg_name }}.rpm" + state: present + register: yum_result + +- name: verify installation + assert: + that: + - "yum_result.rc == 0" + - "yum_result.changed" + - "not yum_result|failed" + +- name: verify yum module outputs + assert: + that: + - "'changed' in yum_result" + - "'msg' in yum_result" + - "'rc' in yum_result" + - "'results' in yum_result" + +- name: install the downloaded rpm again + yum: + name: "/tmp/{{ pkg_name }}.rpm" + state: present + register: yum_result + +- name: verify installation + assert: + that: + - "yum_result.rc == 0" + - "not yum_result.changed" + - "not yum_result|failed" + +- name: verify yum module outputs + assert: + that: + - "'changed' in yum_result" + - "'msg' in yum_result" + - "'rc' in yum_result" + - "'results' in yum_result" + +- name: clean up + yum: + name: "{{ pkg_name }}" + state: absent + +- name: install from url + yum: + name: "{{ pkg_url }}" + state: present + register: yum_result + +- name: verify installation + assert: + that: + - "yum_result.rc == 0" + - "yum_result.changed" + - "not yum_result|failed" + +- name: verify yum module outputs + assert: + that: + - "'changed' in yum_result" + - "'msg' in yum_result" + - "'rc' in yum_result" + - "'results' in yum_result"