Skip to content

Commit

Permalink
snap tests: re-enable test for --dangerous using smaller snap (#8861)
Browse files Browse the repository at this point in the history
  • Loading branch information
russoz authored Sep 13, 2024
1 parent 94472dd commit 76ebda7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 34 deletions.
5 changes: 2 additions & 3 deletions tests/integration/targets/snap/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
ansible.builtin.include_tasks: test.yml
- name: Include test_channel
ansible.builtin.include_tasks: test_channel.yml
# TODO: Find better package to download and install from sources - cider 1.6.0 takes over 35 seconds to install
# - name: Include test_dangerous
# ansible.builtin.include_tasks: test_dangerous.yml
- name: Include test_dangerous
ansible.builtin.include_tasks: test_dangerous.yml
- name: Include test_3dash
ansible.builtin.include_tasks: test_3dash.yml
- name: Include test_empty_list
Expand Down
67 changes: 36 additions & 31 deletions tests/integration/targets/snap/tasks/test_dangerous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,48 @@

# NOTE This is currently disabled for performance reasons!

- name: Make sure package is not installed (cider)
- name: Make sure package is not installed (bpytop)
community.general.snap:
name: cider
name: bpytop
state: absent

- name: Download cider snap
ansible.builtin.get_url:
url: https://github.com/ciderapp/cider-releases/releases/download/v1.6.0/cider_1.6.0_amd64.snap
dest: "{{ remote_tmp_dir }}/cider_1.6.0_amd64.snap"
mode: "0644"

# Test for https://github.com/ansible-collections/community.general/issues/5715
- name: Install package from file (check)
community.general.snap:
name: "{{ remote_tmp_dir }}/cider_1.6.0_amd64.snap"
dangerous: true
state: present
check_mode: true
register: install_dangerous_check

- name: Install package from file
community.general.snap:
name: "{{ remote_tmp_dir }}/cider_1.6.0_amd64.snap"
dangerous: true
state: present
register: install_dangerous

- name: Install package from file
community.general.snap:
name: "{{ remote_tmp_dir }}/cider_1.6.0_amd64.snap"
dangerous: true
state: present
register: install_dangerous_idempot
- name: Download bpytop snap
ansible.builtin.command:
cmd: snap download bpytop
chdir: "{{ remote_tmp_dir }}"
register: bpytop_download

- name: Test block
vars:
snap_file: "{{ (bpytop_download.stdout_lines[-1] | split(' '))[-1] }}"
snap_path: "{{ remote_tmp_dir }}/{{ snap_file }}"
block:
# Test for https://github.com/ansible-collections/community.general/issues/5715
- name: Install package from file (check)
community.general.snap:
name: "{{ snap_path }}"
dangerous: true
state: present
check_mode: true
register: install_dangerous_check

- name: Install package from file
community.general.snap:
name: "{{ snap_path }}"
dangerous: true
state: present
register: install_dangerous

- name: Install package from file (again)
community.general.snap:
name: "{{ snap_path }}"
dangerous: true
state: present
register: install_dangerous_idempot

- name: Remove package
community.general.snap:
name: cider
name: bpytop
state: absent
register: remove_dangerous

Expand Down

0 comments on commit 76ebda7

Please sign in to comment.