diff options
author | inifares23lab <62902848+inifares23lab@users.noreply.github.com> | 2022-11-02 16:02:04 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-02 12:02:04 -0400 |
commit | e2450d4886c43528ee8a870cc23cac73afdc6144 (patch) | |
tree | b22aefe60751ee01a326882e5f5d92eff75a077f /test | |
parent | 26a477561168cd731c86fb1ceffb0394c81cb0a7 (diff) | |
download | ansible-e2450d4886c43528ee8a870cc23cac73afdc6144.tar.gz |
added --allow-change-held-packages for apt remove (#78203)
* added --allow-change-held-packages for apt remove
* add tests for apt remove (allow_change_held_packages=yes)
* add changelog for apt remove (allow-change-held-packages=yes)
* update tests for apt remove (allow_change_held_packages=yes)
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/targets/apt/tasks/apt.yml | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/test/integration/targets/apt/tasks/apt.yml b/test/integration/targets/apt/tasks/apt.yml index d273eda71e..a0bc19929f 100644 --- a/test/integration/targets/apt/tasks/apt.yml +++ b/test/integration/targets/apt/tasks/apt.yml @@ -372,7 +372,7 @@ - libcaca-dev - libslang2-dev -# https://github.com/ansible/ansible/issues/38995 +# # https://github.com/ansible/ansible/issues/38995 - name: build-dep for a package apt: name: tree @@ -524,6 +524,55 @@ - "allow_change_held_packages_no_update is not changed" - "allow_change_held_packages_hello_version.stdout == allow_change_held_packages_hello_version_again.stdout" +# Remove pkg on hold +- name: Put hello on hold + shell: apt-mark hold hello + +- name: Get hold list + shell: apt-mark showhold + register: hello_hold + +- name: Check that the package hello is on the hold list + assert: + that: + - "'hello' in hello_hold.stdout" + +- name: Try removing package hello + apt: + name: hello + state: absent + register: package_removed + ignore_errors: true + +- name: verify the package is not removed with dpkg + shell: dpkg -l hello + register: dpkg_result + +- name: Verify that package was not removed + assert: + that: + - package_removed is failed + - dpkg_result is success + +- name: Try removing package (allow_change_held_packages=yes) + apt: + name: hello + state: absent + allow_change_held_packages: yes + register: package_removed + +- name: verify the package is removed with dpkg + shell: dpkg -l hello + register: dpkg_result + ignore_errors: true + +- name: Verify that package removal was succesfull + assert: + that: + - package_removed is success + - dpkg_result is failed + - package_removed.changed + # Virtual package - name: Install a virtual package apt: |