Readd zypper tests (#33203)
* Readd zypper tests The tests were reenabled in #33034, but some tests were removed. Readd the tests in a mostly distro-version-independent way. * Remove with_items and use native yaml * Dynamically determine test URL
This commit is contained in:
parent
1183029591
commit
1572df6802
1 changed files with 104 additions and 24 deletions
|
@ -1,6 +1,18 @@
|
|||
- name: get hello package version
|
||||
shell: zypper --xml se -svx hello | grep 'name="hello"' | sed 's/.*edition="\([^ ]*\)".*/\1/'
|
||||
register: hello_version
|
||||
|
||||
- name: set URL of test package
|
||||
set_fact:
|
||||
hello_package_url: http://download.opensuse.org/distribution/leap/{{ ansible_distribution_version }}/repo/oss/suse/x86_64/hello-{{hello_version.stdout}}.x86_64.rpm
|
||||
|
||||
- debug: var=hello_package_url
|
||||
|
||||
# UNINSTALL
|
||||
- name: uninstall hello
|
||||
zypper: name=hello state=removed
|
||||
zypper:
|
||||
name: hello
|
||||
state: removed
|
||||
register: zypper_result
|
||||
|
||||
- name: check hello with rpm
|
||||
|
@ -19,7 +31,9 @@
|
|||
|
||||
# UNINSTALL AGAIN
|
||||
- name: uninstall hello again
|
||||
zypper: name=hello state=removed
|
||||
zypper:
|
||||
name: hello
|
||||
state: removed
|
||||
register: zypper_result
|
||||
|
||||
- name: verify no change on re-uninstall
|
||||
|
@ -29,7 +43,9 @@
|
|||
|
||||
# INSTALL
|
||||
- name: install hello
|
||||
zypper: name=hello state=present
|
||||
zypper:
|
||||
name: hello
|
||||
state: present
|
||||
register: zypper_result
|
||||
|
||||
- name: check hello with rpm
|
||||
|
@ -49,7 +65,9 @@
|
|||
|
||||
# INSTALL AGAIN
|
||||
- name: install hello again
|
||||
zypper: name=hello state=present
|
||||
zypper:
|
||||
name: hello
|
||||
state: present
|
||||
register: zypper_result
|
||||
|
||||
- name: verify no change on second install
|
||||
|
@ -117,7 +135,9 @@
|
|||
|
||||
# INSTALL nonexistent package
|
||||
- name: install hello from url
|
||||
zypper: name=doesnotexist state=present
|
||||
zypper:
|
||||
name: doesnotexist
|
||||
state: present
|
||||
register: zypper_result
|
||||
ignore_errors: yes
|
||||
|
||||
|
@ -140,8 +160,8 @@
|
|||
|
||||
- name: install broken rpm
|
||||
zypper:
|
||||
name="{{output_dir | expanduser}}/zypper1/broken.rpm"
|
||||
state=present
|
||||
name: "{{output_dir | expanduser}}/zypper1/broken.rpm"
|
||||
state: present
|
||||
register: zypper_result
|
||||
ignore_errors: yes
|
||||
|
||||
|
@ -230,25 +250,31 @@
|
|||
register: zypper_res1
|
||||
|
||||
- name: install and remove again, leave out plus
|
||||
zypper: name={{item}} state=present
|
||||
with_items:
|
||||
- metamail
|
||||
- -hello
|
||||
zypper:
|
||||
name:
|
||||
- metamail
|
||||
- -hello
|
||||
state: present
|
||||
register: zypper_res1a
|
||||
|
||||
- name: in and rm swapped
|
||||
zypper: name={{item}} state=present
|
||||
with_items:
|
||||
- -metamail
|
||||
- hello
|
||||
zypper:
|
||||
name:
|
||||
- -metamail
|
||||
- hello
|
||||
state: present
|
||||
register: zypper_res1b
|
||||
|
||||
- name: install metamail
|
||||
zypper: name=metamail state=absent
|
||||
zypper:
|
||||
name: metamail
|
||||
state: absent
|
||||
register: zypper_res2
|
||||
|
||||
- name: remove hello
|
||||
zypper: name=hello state=present
|
||||
zypper:
|
||||
name: hello
|
||||
state: present
|
||||
register: zypper_res3
|
||||
|
||||
- name: verify simultaneous install/remove worked
|
||||
|
@ -263,10 +289,11 @@
|
|||
|
||||
|
||||
- name: install and remove with state=absent
|
||||
zypper: name={{item}} state=absent
|
||||
with_items:
|
||||
- metamail
|
||||
- +hello
|
||||
zypper:
|
||||
name:
|
||||
- metamail
|
||||
- +hello
|
||||
state: absent
|
||||
register: zypper_res
|
||||
ignore_errors: yes
|
||||
|
||||
|
@ -274,10 +301,13 @@
|
|||
assert:
|
||||
that:
|
||||
- zypper_res is failed
|
||||
- zypper_res.results[0].msg == "Can not combine '+' prefix with state=remove/absent."
|
||||
- zypper_res.msg == "Can not combine '+' prefix with state=remove/absent."
|
||||
|
||||
- name: try rm patch
|
||||
zypper: name=openSUSE-2016-128 type=patch state=absent
|
||||
zypper:
|
||||
name: openSUSE-2016-128
|
||||
type: patch
|
||||
state: absent
|
||||
ignore_errors: yes
|
||||
register: zypper_patch
|
||||
- assert:
|
||||
|
@ -286,7 +316,9 @@
|
|||
- zypper_patch.msg.startswith('Can not remove patches.')
|
||||
|
||||
- name: try rm URL
|
||||
zypper: name=http://download.opensuse.org/repositories/openSUSE:/Leap:/{{ ansible_distribution_version }}/standard/x86_64/hello-2.9-6.2.x86_64.rpm state=absent
|
||||
zypper:
|
||||
name: "{{ hello_package_url }}"
|
||||
state: absent
|
||||
ignore_errors: yes
|
||||
register: zypper_rm
|
||||
- assert:
|
||||
|
@ -294,6 +326,54 @@
|
|||
- zypper_rm is failed
|
||||
- zypper_rm.msg.startswith('Can not remove via URL.')
|
||||
|
||||
- name: remove pattern update_test
|
||||
zypper:
|
||||
name: update_test
|
||||
type: pattern
|
||||
state: absent
|
||||
|
||||
- name: install pattern update_test
|
||||
zypper:
|
||||
name: update_test
|
||||
type: pattern
|
||||
state: present
|
||||
register: zypper_install_pattern1
|
||||
|
||||
- name: install pattern update_test again
|
||||
zypper:
|
||||
name: update_test
|
||||
type: pattern
|
||||
state: present
|
||||
register: zypper_install_pattern2
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- zypper_install_pattern1 is changed
|
||||
- zypper_install_pattern2 is not changed
|
||||
|
||||
- name: remove hello
|
||||
zypper:
|
||||
name: hello
|
||||
state: absent
|
||||
|
||||
- name: install via URL
|
||||
zypper:
|
||||
state: present
|
||||
name: "{{ hello_package_url }}"
|
||||
register: zypperin1
|
||||
|
||||
- name: test install
|
||||
zypper:
|
||||
name: hello
|
||||
state: present
|
||||
register: zypperin2
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- zypperin1 is succeeded
|
||||
- zypperin1 is changed
|
||||
- zypperin2 is not changed
|
||||
|
||||
# check for https://github.com/ansible/ansible/issues/20139
|
||||
- name: run updatecache
|
||||
zypper:
|
||||
|
|
Loading…
Reference in a new issue