Skip to content

Commit

Permalink
yum: add integration tests for installing from URL (ansible#30616)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrizek authored Oct 5, 2017
1 parent e7902d8 commit 08bffbc
Showing 1 changed file with 88 additions and 1 deletion.
89 changes: 88 additions & 1 deletion test/integration/targets/yum/tasks/yum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"

0 comments on commit 08bffbc

Please sign in to comment.