From 76ebda7fafa29e8d19da56da20c1d656bae48c34 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Sat, 14 Sep 2024 08:46:48 +1200 Subject: [PATCH] snap tests: re-enable test for --dangerous using smaller snap (#8861) --- tests/integration/targets/snap/tasks/main.yml | 5 +- .../targets/snap/tasks/test_dangerous.yml | 61 ++++++++++--------- 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/tests/integration/targets/snap/tasks/main.yml b/tests/integration/targets/snap/tasks/main.yml index a2d8698d0f..e96fbde38b 100644 --- a/tests/integration/targets/snap/tasks/main.yml +++ b/tests/integration/targets/snap/tasks/main.yml @@ -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 diff --git a/tests/integration/targets/snap/tasks/test_dangerous.yml b/tests/integration/targets/snap/tasks/test_dangerous.yml index 8fe4edee0b..e85725992d 100644 --- a/tests/integration/targets/snap/tasks/test_dangerous.yml +++ b/tests/integration/targets/snap/tasks/test_dangerous.yml @@ -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" +- name: Download bpytop snap + ansible.builtin.command: + cmd: snap download bpytop + chdir: "{{ remote_tmp_dir }}" + register: bpytop_download -# 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: 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: "{{ 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: "{{ snap_path }}" + 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: 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