diff options
author | Martin Krizek <martin.krizek@gmail.com> | 2024-07-29 10:41:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-29 10:41:23 +0200 |
commit | 07a1d6a3fda5bea4fd5496f9c229687ad0af014a (patch) | |
tree | d3288ef239e606d5a8611d5e0144913baffe9a64 /test/integration/targets/dnf | |
parent | validate-modules: detect names set mismatch between argument spec and documen... (diff) | |
download | ansible-07a1d6a3fda5bea4fd5496f9c229687ad0af014a.tar.xz ansible-07a1d6a3fda5bea4fd5496f9c229687ad0af014a.zip |
dnf/setup_rpm_repo: simplify dummy testing repos (#83624)
This change simplifies construction and footprint of testing rpm
repository created by rpmfluff:
* all packages default to noarch
* only when necessary build package for a specific architecture(s)
* do not build several repositories each for specific arch
* remove duplicate "incompatible arch" test
* skip_broken_and_nobest: move testing packages from an external repo
into our dummy repo for transparency
* remove compatibility code from create_repo.py for versions no longer
needed
* remove support for old OS versions from setup_rpm_repo
* simplify representation of an rpm in create_repo.py to allow easier
changes
Notes
* there is one more external testing repo used at
https://ci-files.testing.ansible.com/test/integration/targets/setup_rpm_repo/repo-with-updateinfo
Diffstat (limited to 'test/integration/targets/dnf')
-rw-r--r-- | test/integration/targets/dnf/tasks/main.yml | 1 | ||||
-rw-r--r-- | test/integration/targets/dnf/tasks/multilib.yml | 70 | ||||
-rw-r--r-- | test/integration/targets/dnf/tasks/repo.yml | 96 | ||||
-rw-r--r-- | test/integration/targets/dnf/tasks/skip_broken_and_nobest.yml | 31 | ||||
-rw-r--r-- | test/integration/targets/dnf/vars/main.yml | 2 |
5 files changed, 81 insertions, 119 deletions
diff --git a/test/integration/targets/dnf/tasks/main.yml b/test/integration/targets/dnf/tasks/main.yml index 9f43d1df24..633a238d76 100644 --- a/test/integration/targets/dnf/tasks/main.yml +++ b/test/integration/targets/dnf/tasks/main.yml @@ -30,6 +30,7 @@ - include_tasks: dnfinstallroot.yml - include_tasks: logging.yml - include_tasks: cacheonly.yml + - include_tasks: multilib.yml when: ansible_distribution in ['Fedora', 'RedHat'] # Attempting to install a different RHEL release in a tmpdir doesn't work (rhel8 beta) diff --git a/test/integration/targets/dnf/tasks/multilib.yml b/test/integration/targets/dnf/tasks/multilib.yml new file mode 100644 index 0000000000..d251721d84 --- /dev/null +++ b/test/integration/targets/dnf/tasks/multilib.yml @@ -0,0 +1,70 @@ +- name: create conf file that forces x86_64 arch + copy: + content: | + [main] + arch=x86_64 + ignorearch=true + dest: "{{ remote_tmp_dir }}/dnf-multilib.conf" + +- name: setting arch works differently in dnf5 + copy: + content: | + x86_64 + dest: /etc/dnf/vars/arch + when: dnf5|default(false) + +- block: + - name: test that only evr is compared, avoiding a situation when a specific arch would be considered as a "newer" package + dnf: + name: "{{ item }}" + state: present + loop: + - "multilib-dinginessentail-1.0-1.x86_64" + - "multilib-dinginessentail-1.0-1.i686" + register: dnf_results + + - assert: + that: + - dnf_results["results"][0] is changed + - dnf_results["results"][1] is changed + + - name: make sure multilib-dinginessentail is not installed + dnf: + name: multilib-dinginessentail + state: absent + + - name: install multilib-dinginessentail both archs + dnf: + name: + - "{{ repodir }}/multilib-dinginessentail-1.1-1.x86_64.rpm" + - "{{ repodir }}/multilib-dinginessentail-1.1-1.i686.rpm" + state: present + disable_gpg_check: true + + - name: try to install lower version of multilib-dinginessentail from rpm file, without allow_downgrade, just one arch + dnf: + name: "{{ repodir }}/multilib-dinginessentail-1.0-1.i686.rpm" + state: present + register: dnf_result + + - name: check multilib-dinginessentail with rpm + shell: rpm -q multilib-dinginessentail + register: rpm_result + + - name: verify installation + assert: + that: + - "not dnf_result.changed" + - "rpm_result.stdout_lines[0].startswith('multilib-dinginessentail-1.1-1')" + - "rpm_result.stdout_lines[1].startswith('multilib-dinginessentail-1.1-1')" + always: + - name: Clean up + dnf: + name: multilib-dinginessentail + state: absent + - file: + name: /etc/dnf/vars/arch + state: absent + module_defaults: + dnf: + conf_file: "{{ remote_tmp_dir }}/dnf-multilib.conf" diff --git a/test/integration/targets/dnf/tasks/repo.yml b/test/integration/targets/dnf/tasks/repo.yml index 31ad963334..cabb8da929 100644 --- a/test/integration/targets/dnf/tasks/repo.yml +++ b/test/integration/targets/dnf/tasks/repo.yml @@ -61,7 +61,7 @@ # ============================================================================ - name: Install dinginessentail-1:1.0-2 dnf: - name: "dinginessentail-1:1.0-2.{{ ansible_architecture }}" + name: "dinginessentail-1:1.0-2.noarch" state: present register: dnf_result @@ -103,7 +103,7 @@ # ============================================================================ - name: Install dinginessentail-1.0-1 from a file (higher version is already installed) dnf: - name: "{{ repodir }}/dinginessentail-1.0-1.{{ ansible_architecture }}.rpm" + name: "{{ repodir }}/dinginessentail-1.0-1.noarch.rpm" state: present disable_gpg_check: True register: dnf_result @@ -127,7 +127,7 @@ # ============================================================================ - name: Install dinginessentail-1.0-1 from a file (downgrade) dnf: - name: "{{ repodir }}/dinginessentail-1.0-1.{{ ansible_architecture }}.rpm" + name: "{{ repodir }}/dinginessentail-1.0-1.noarch.rpm" state: present allow_downgrade: True disable_gpg_check: True @@ -155,7 +155,7 @@ # ============================================================================ - name: Install dinginessentail-1.0-1 from a file dnf: - name: "{{ repodir }}/dinginessentail-1.0-1.{{ ansible_architecture }}.rpm" + name: "{{ repodir }}/dinginessentail-1.0-1.noarch.rpm" state: present disable_gpg_check: True register: dnf_result @@ -177,7 +177,7 @@ # ============================================================================ - name: Install dinginessentail-1.0-1 from a file again dnf: - name: "{{ repodir }}/dinginessentail-1.0-1.{{ ansible_architecture }}.rpm" + name: "{{ repodir }}/dinginessentail-1.0-1.noarch.rpm" state: present disable_gpg_check: True register: dnf_result @@ -194,7 +194,7 @@ # ============================================================================ - name: Install dinginessentail-1.0-2 from a file dnf: - name: "{{ repodir }}/dinginessentail-1.0-2.{{ ansible_architecture }}.rpm" + name: "{{ repodir }}/dinginessentail-1.0-2.noarch.rpm" state: present disable_gpg_check: True register: dnf_result @@ -216,7 +216,7 @@ # ============================================================================ - name: Install dinginessentail-1.0-2 from a file again dnf: - name: "{{ repodir }}/dinginessentail-1.0-2.{{ ansible_architecture }}.rpm" + name: "{{ repodir }}/dinginessentail-1.0-2.noarch.rpm" state: present disable_gpg_check: True register: dnf_result @@ -231,31 +231,6 @@ - "not dnf_result.changed" - "rpm_result.stdout.startswith('dinginessentail-1.0-2')" # ============================================================================ - - name: Remove dinginessentail - dnf: - name: dinginessentail - state: absent - - - name: Try to install incompatible arch - dnf: - name: "{{ repodir_ppc64 }}/dinginessentail-1.0-1.ppc64.rpm" - state: present - register: dnf_result - ignore_errors: yes - - - name: Check dinginessentail with rpm - shell: rpm -q dinginessentail - register: rpm_result - ignore_errors: yes - - - name: Verify installation - assert: - that: - - "rpm_result.rc == 1" - - "not dnf_result.changed" - - "dnf_result is failed" - # ============================================================================ - # Should install dinginessentail-with-weak-dep and dinginessentail-weak-dep - name: Install package with defaults dnf: @@ -542,60 +517,3 @@ dnf: name: provides_foo* state: absent - -- name: test that only evr is compared, avoiding a situation when a specific arch would be considered as a "newer" package - block: - - dnf: - name: "{{ item }}" - state: present - loop: - - "dinginessentail-1.0-1.x86_64" - - "dinginessentail-1.0-1.i686" - register: dnf_results - - - assert: - that: - - dnf_results["results"][0] is changed - - dnf_results["results"][1] is changed - always: - - name: Clean up - dnf: - name: dinginessentail - state: absent - -- block: - - name: make sure dinginessentail is not installed - dnf: - name: dinginessentail - state: absent - - - name: install dinginessentail both archs - dnf: - name: - - "{{ repodir }}/dinginessentail-1.1-1.x86_64.rpm" - - "{{ repodir_i686 }}/dinginessentail-1.1-1.i686.rpm" - state: present - disable_gpg_check: true - - - name: try to install lower version of dinginessentail from rpm file, without allow_downgrade, just one arch - dnf: - name: "{{ repodir_i686 }}/dinginessentail-1.0-1.i686.rpm" - state: present - register: dnf_result - - - name: check dinginessentail with rpm - shell: rpm -q dinginessentail - register: rpm_result - - - name: verify installation - assert: - that: - - "not dnf_result.changed" - - "rpm_result.stdout_lines[0].startswith('dinginessentail-1.1-1')" - - "rpm_result.stdout_lines[1].startswith('dinginessentail-1.1-1')" - always: - - name: Clean up - dnf: - name: dinginessentail - state: absent - when: ansible_architecture == "x86_64" diff --git a/test/integration/targets/dnf/tasks/skip_broken_and_nobest.yml b/test/integration/targets/dnf/tasks/skip_broken_and_nobest.yml index 374796658f..c50457c9c1 100644 --- a/test/integration/targets/dnf/tasks/skip_broken_and_nobest.yml +++ b/test/integration/targets/dnf/tasks/skip_broken_and_nobest.yml @@ -3,20 +3,9 @@ # # There are a lot of fairly complex, corner cases we test here especially towards the end. # -# The test repo is generated from the "skip-broken" repo in this repository: -# https://github.com/relrod/ansible-ci-contrived-yum-repos +# The test repo is generated by the setup_rpm_repo role. # -# It is laid out like this: -# -# There are three packages, `broken-a`, `broken-b`, `broken-c`. -# -# * broken-a has three versions: 1.2.3, 1.2.3.4, 1.2.4, 2.0.0. -# * 1.2.3 and 1.2.4 have no dependencies -# * 1.2.3.4 and 2.0.0 both depend on a non-existent package (to break depsolving) -# -# * broken-b depends on broken-a-1.2.3 -# * broken-c depends on broken-a-1.2.4 -# * broken-d depends on broken-a (no version constraint) +# See test/integration/targets/setup_rpm_repo/library/create_repo.py for how the repo is laid out. # # This allows us to test various upgrades, downgrades, and installs with broken dependencies. # skip_broken should usually be successful in the upgrade/downgrade case, it will just do nothing. @@ -26,14 +15,6 @@ # will try to install 2.0.0 which is broken. With nobest=true, it will fall back to 1.2.4. Similar # for upgrading. - block: - - name: Set up test yum repo - yum_repository: - name: skip-broken - description: ansible-test skip-broken test repo - baseurl: "{{ skip_broken_repo_baseurl }}" - gpgcheck: no - repo_gpgcheck: no - - name: Install two packages dnf: name: @@ -240,8 +221,7 @@ - name: Do an "upgrade" to an older version of broken-a, allow_downgrade=false dnf: name: - #- broken-a-1.2.3-1* - - broken-a-1.2.3-1.el7.x86_64 + - broken-a-1.2.3-1.noarch state: latest allow_downgrade: false check_mode: true @@ -327,11 +307,6 @@ when: not dnf5|default(false) always: - - name: Remove test yum repo - yum_repository: - name: skip-broken - state: absent - - name: Remove all test packages installed dnf: name: diff --git a/test/integration/targets/dnf/vars/main.yml b/test/integration/targets/dnf/vars/main.yml index 90b6856217..86588de335 100644 --- a/test/integration/targets/dnf/vars/main.yml +++ b/test/integration/targets/dnf/vars/main.yml @@ -2,5 +2,3 @@ dnf_log_files: - /var/log/dnf.log - /var/log/dnf.rpm.log - /var/log/dnf.librepo.log - -skip_broken_repo_baseurl: "https://ci-files.testing.ansible.com/test/integration/targets/dnf/skip-broken/RPMS/" |