Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snap: add tests for multiple commands #5488

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/integration/targets/setup_snap/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
package:
name: "{{ snap_packages }}"
state: absent
become: true
russoz marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions tests/integration/targets/setup_snap/tasks/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@
name: "{{ snap_packages }}"
state: present
notify: Remove snapd
become: true

- name: Make sure that snapd is running
service:
name: snapd
state: started
become: true

- name: Create link /snap
file:
src: /var/lib/snapd/snap
dest: /snap
state: link
become: true

- name: Inform that snap is installed
set_fact:
Expand Down
40 changes: 40 additions & 0 deletions tests/integration/targets/snap/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- name: Has-snap block
when: has_snap
become: true
block:
- name: Make sure package is not installed (hello-world)
community.general.snap:
Expand Down Expand Up @@ -191,3 +192,42 @@
- "'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
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
russoz marked this conversation as resolved.
Show resolved Hide resolved

- 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"