diff options
author | Abhijeet Kasurde <akasurde@redhat.com> | 2021-04-30 00:44:18 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-29 15:14:18 -0400 |
commit | 1a7923e3180001911a5a0df0f2fa7f925884d789 (patch) | |
tree | f15003e2f661a3405566c1d36235218193716f86 /test/integration/targets/pip | |
parent | f1a5c411d9beef3d9a29a9529c7e8dfcbeebf7b6 (diff) | |
download | ansible-1a7923e3180001911a5a0df0f2fa7f925884d789.tar.gz |
pip: Idempotency tests (#74473)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: David Moreau Simard <dmsimard@redhat.com>
Diffstat (limited to 'test/integration/targets/pip')
-rw-r--r-- | test/integration/targets/pip/tasks/pip.yml | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/test/integration/targets/pip/tasks/pip.yml b/test/integration/targets/pip/tasks/pip.yml index 572c7b6f31..2b9ad561a5 100644 --- a/test/integration/targets/pip/tasks/pip.yml +++ b/test/integration/targets/pip/tasks/pip.yml @@ -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 - pip: - name: q - state: present - version: "" - virtualenv: "{{ output_dir }}/pipenv" - register: pip_install_empty_version_string +- block: + - name: Ensure previous virtualenv no longer exists + file: + state: absent + name: "{{ output_dir }}/pipenv" -- name: ensure that task installation did not fail - assert: - that: - - pip_install_empty_version_string is successful + - name: do not consider an empty string as a version + pip: + name: q + state: present + version: "" + virtualenv: "{{ output_dir }}/pipenv" + register: pip_empty_version_string + + - 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_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 |