pip: Idempotency tests (#74473)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com> Co-authored-by: David Moreau Simard <dmsimard@redhat.com>
This commit is contained in:
parent
f1a5c411d9
commit
1a7923e318
1 changed files with 44 additions and 11 deletions
|
@ -310,18 +310,51 @@
|
|||
- "not (pip_install_empty is changed)"
|
||||
|
||||
# https://github.com/ansible/ansible/issues/41043
|
||||
- name: do not consider an empty string as a version
|
||||
- block:
|
||||
- name: Ensure previous virtualenv no longer exists
|
||||
file:
|
||||
state: absent
|
||||
name: "{{ output_dir }}/pipenv"
|
||||
|
||||
- name: do not consider an empty string as a version
|
||||
pip:
|
||||
name: q
|
||||
state: present
|
||||
version: ""
|
||||
virtualenv: "{{ output_dir }}/pipenv"
|
||||
register: pip_install_empty_version_string
|
||||
register: pip_empty_version_string
|
||||
|
||||
- name: ensure that task installation did not fail
|
||||
- name: test idempotency with empty string
|
||||
pip:
|
||||
name: q
|
||||
state: present
|
||||
version: ""
|
||||
virtualenv: "{{ output_dir }}/pipenv"
|
||||
register: pip_empty_version_string_idempotency
|
||||
|
||||
- name: test idempotency without empty string
|
||||
pip:
|
||||
name: q
|
||||
state: present
|
||||
virtualenv: "{{ output_dir }}/pipenv"
|
||||
register: pip_no_empty_version_string_idempotency
|
||||
|
||||
# 'present' and version=="" is analogous to latest when first installed
|
||||
- name: ensure we installed the latest version
|
||||
pip:
|
||||
name: q
|
||||
state: latest
|
||||
virtualenv: "{{ output_dir }}/pipenv"
|
||||
register: pip_empty_version_idempotency
|
||||
|
||||
- name: ensure that installation worked and is idempotent
|
||||
assert:
|
||||
that:
|
||||
- pip_install_empty_version_string is successful
|
||||
- pip_empty_version_string is changed
|
||||
- pip_empty_version_string is successful
|
||||
- pip_empty_version_idempotency is not changed
|
||||
- pip_no_empty_version_string_idempotency is not changed
|
||||
- pip_empty_version_string_idempotency is not changed
|
||||
|
||||
# test version specifiers
|
||||
- name: make sure no test_package installed now
|
||||
|
|
Loading…
Reference in a new issue