summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/yum_repository
diff options
context:
space:
mode:
authorSam Doran <sdoran@redhat.com>2021-02-04 02:34:12 +0100
committerGitHub <noreply@github.com>2021-02-04 02:34:12 +0100
commit997b2d2a1955ccb4e70f805c18dc3e227e86c678 (patch)
tree9dd8ed3252c45516fe56d9c423df41eceb019a01 /test/integration/targets/yum_repository
parentadd option to upgrade collections (#73336) (diff)
downloadansible-997b2d2a1955ccb4e70f805c18dc3e227e86c678.tar.xz
ansible-997b2d2a1955ccb4e70f805c18dc3e227e86c678.zip
Make yum_repository test more reliable (#73467)
* Improve setup_rpm_repo - add handlers to remove repos - add variable to control whethere or not repos are created * Use local repo for all distros * Change repo creation script to module
Diffstat (limited to 'test/integration/targets/yum_repository')
-rw-r--r--test/integration/targets/yum_repository/defaults/main.yml5
-rw-r--r--test/integration/targets/yum_repository/handlers/main.yml4
-rw-r--r--test/integration/targets/yum_repository/meta/main.yml4
-rw-r--r--test/integration/targets/yum_repository/tasks/main.yml33
-rw-r--r--test/integration/targets/yum_repository/vars/CentOS-6.yml10
-rw-r--r--test/integration/targets/yum_repository/vars/CentOS-8.yml10
-rw-r--r--test/integration/targets/yum_repository/vars/CentOS.yml10
-rw-r--r--test/integration/targets/yum_repository/vars/Fedora.yml5
-rw-r--r--test/integration/targets/yum_repository/vars/default.yml0
9 files changed, 14 insertions, 67 deletions
diff --git a/test/integration/targets/yum_repository/defaults/main.yml b/test/integration/targets/yum_repository/defaults/main.yml
new file mode 100644
index 0000000000..4c1fbc652e
--- /dev/null
+++ b/test/integration/targets/yum_repository/defaults/main.yml
@@ -0,0 +1,5 @@
+yum_repository_test_package: dinginessentail
+yum_repository_test_repo:
+ name: fakerepo
+ description: Fake Repo
+ baseurl: "file://{{ repodir }}"
diff --git a/test/integration/targets/yum_repository/handlers/main.yml b/test/integration/targets/yum_repository/handlers/main.yml
new file mode 100644
index 0000000000..f96c23917b
--- /dev/null
+++ b/test/integration/targets/yum_repository/handlers/main.yml
@@ -0,0 +1,4 @@
+- name: remove listtest repo
+ yum_repository:
+ name: listtest
+ state: absent
diff --git a/test/integration/targets/yum_repository/meta/main.yml b/test/integration/targets/yum_repository/meta/main.yml
new file mode 100644
index 0000000000..56539a4f55
--- /dev/null
+++ b/test/integration/targets/yum_repository/meta/main.yml
@@ -0,0 +1,4 @@
+dependencies:
+ - role: setup_rpm_repo
+ vars:
+ install_repos: no
diff --git a/test/integration/targets/yum_repository/tasks/main.yml b/test/integration/targets/yum_repository/tasks/main.yml
index 1eabf51b03..d81957755c 100644
--- a/test/integration/targets/yum_repository/tasks/main.yml
+++ b/test/integration/targets/yum_repository/tasks/main.yml
@@ -1,17 +1,6 @@
- name: Run tests
when: ansible_facts.distribution in ['CentOS', 'Fedora']
block:
- - name: Include distribution specific variables
- include_vars: "{{ lookup('first_found', params) }}"
- vars:
- params:
- files:
- - "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
- - "{{ ansible_facts.distribution }}.yml"
- - default.yml
- paths:
- - vars
-
- name: ensure {{ yum_repository_test_package }} is uninstalled to begin with
action: "{{ ansible_facts.pkg_mgr }}"
args:
@@ -184,6 +173,7 @@
includepkgs:
- ccc
- ddd
+ notify: remove listtest repo
- name: Assert that lists were properly inserted
assert:
@@ -198,24 +188,3 @@
repofile: "{{ lookup('file', '/etc/yum.repos.d/listtest.repo') }}"
url_hostname: "{{ yum_repository_test_repo.baseurl | urlsplit('hostname') }}"
url_hostname2: "{{ url_hostname | replace('download[0-9]?\\.', 'download2\\.', 1) }}"
-
- - name: CLEANUP | Remove list test repo
- yum_repository:
- name: listtest
- state: absent
-
- - name: CLEANUP | Remove {{ yum_repository_test_repo.name }}
- yum_repository:
- name: "{{ yum_repository_test_repo.name }}"
- state: absent
-
- - name: CLEANUP | Enable EPEL
- yum_repository:
- name: epel
- state: present
- description: "{{ yum_repository_epel.description | default(omit) }}"
- metalink: "{{ yum_repository_epel.metalink | default(omit) }}"
- mirrorlist: "{{ yum_repository_epel.mirrorlist | default(omit) }}"
- gpgkey: "{{ yum_repository_epel.gpgkey }}"
- gpgcheck: yes
- when: ansible_facts.distribution == 'CentOS'
diff --git a/test/integration/targets/yum_repository/vars/CentOS-6.yml b/test/integration/targets/yum_repository/vars/CentOS-6.yml
deleted file mode 100644
index db9947d5ea..0000000000
--- a/test/integration/targets/yum_repository/vars/CentOS-6.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-yum_repository_test_package: sl
-yum_repository_test_repo:
- name: epel
- description: EPEL yum repo
- baseurl: https://archives.fedoraproject.org/pub/archive/epel/{{ ansible_facts.distribution_major_version }}/$basearch
-
-yum_repository_epel:
- description: Extra Packages for Enterprise Linux {{ ansible_facts.distribution_major_version }} - $basearch
- mirrorlist: https://mirrors.fedoraproject.org/metalink?repo=epel-{{ ansible_facts.distribution_major_version }}&arch=$basearch
- gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_facts.distribution_major_version }}
diff --git a/test/integration/targets/yum_repository/vars/CentOS-8.yml b/test/integration/targets/yum_repository/vars/CentOS-8.yml
deleted file mode 100644
index 22d4d13e72..0000000000
--- a/test/integration/targets/yum_repository/vars/CentOS-8.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-yum_repository_test_package: sshpass
-yum_repository_test_repo:
- name: epel
- description: EPEL yum repo
- baseurl: https://download.fedoraproject.org/pub/epel/$releasever/Everything/$basearch
-
-yum_repository_epel:
- description: Extra Packages for Enterprise Linux $releasever - $basearch
- metalink: https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch&infra=$infra&content=$contentdir
- gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_facts.distribution_major_version }}
diff --git a/test/integration/targets/yum_repository/vars/CentOS.yml b/test/integration/targets/yum_repository/vars/CentOS.yml
deleted file mode 100644
index 542b722f7a..0000000000
--- a/test/integration/targets/yum_repository/vars/CentOS.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-yum_repository_test_package: sl
-yum_repository_test_repo:
- name: epel
- description: EPEL yum repo
- baseurl: http://download.fedoraproject.org/pub/epel/{{ ansible_facts.distribution_major_version }}/$basearch
-
-yum_repository_epel:
- description: Extra Packages for Enterprise Linux {{ ansible_facts.distribution_major_version }} - $basearch
- mirrorlist: https://mirrors.fedoraproject.org/metalink?repo=epel-{{ ansible_facts.distribution_major_version }}&arch=$basearch
- gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_facts.distribution_major_version }}
diff --git a/test/integration/targets/yum_repository/vars/Fedora.yml b/test/integration/targets/yum_repository/vars/Fedora.yml
deleted file mode 100644
index 8c37eaa107..0000000000
--- a/test/integration/targets/yum_repository/vars/Fedora.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-yum_repository_test_package: libbdplus
-yum_repository_test_repo:
- name: rpmfusion-free
- description: RPM Fusion for Fedora {{ ansible_distribution_major_version }} - Free
- baseurl: http://download1.rpmfusion.org/free/fedora/releases/{{ ansible_distribution_major_version }}/Everything/{{ ansible_architecture }}/os/
diff --git a/test/integration/targets/yum_repository/vars/default.yml b/test/integration/targets/yum_repository/vars/default.yml
deleted file mode 100644
index e69de29bb2..0000000000
--- a/test/integration/targets/yum_repository/vars/default.yml
+++ /dev/null