From d7340945a4a9d8a0a8133ce77084f0f3d6902c88 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Sun, 16 Apr 2023 23:18:34 +1200 Subject: [PATCH] snap: add tests for multiple commands (#5488) * snap: add tests for multiple commands * snap: add tests + become * remove packages again for idempotency * roll back become=true in tests --- tests/integration/targets/snap/tasks/main.yml | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tests/integration/targets/snap/tasks/main.yml b/tests/integration/targets/snap/tasks/main.yml index 21b0c8124a..0f24e69f3d 100644 --- a/tests/integration/targets/snap/tasks/main.yml +++ b/tests/integration/targets/snap/tasks/main.yml @@ -191,3 +191,53 @@ - "'uhttpd:document-root-dir=/tmp' in install_with_option_changed.options_changed" - "'uhttpd:listening-port=8080' not in install_with_option_changed.options_changed" - remove is changed + + - name: Install two packages at the same time + community.general.snap: + name: + - hello-world + - uhttpd + state: present + register: install_two + + - name: Install two packages at the same time (again) + community.general.snap: + name: + - hello-world + - uhttpd + state: present + register: install_two_again + + - name: Remove packages (hello-world & uhttpd) + community.general.snap: + name: + - hello-world + - uhttpd + state: absent + register: install_two_remove + + - name: Remove packages again (hello-world & uhttpd) + community.general.snap: + name: + - hello-world + - uhttpd + state: absent + register: install_two_remove_again + + - name: Assert installation of two packages + assert: + that: + - install_two is changed + - "'hello-world' in install_two.snaps_installed" + - "'uhttpd' in install_two.snaps_installed" + - install_two.snaps_removed is not defined + - install_two_again is not changed + - install_two_again.snaps_installed is not defined + - install_two_again.snaps_removed is not defined + - install_two_remove is changed + - install_two_again.snaps_installed is not defined + - "'hello-world' in install_two_remove.snaps_removed" + - "'uhttpd' in install_two_remove.snaps_removed" + - install_two_remove_again is not changed + - install_two_remove_again.snaps_installed is not defined + - install_two_remove_again.snaps_removed is not defined