summaryrefslogtreecommitdiffstats
path: root/test/integration/targets
diff options
context:
space:
mode:
authorMartin Krizek <martin.krizek@gmail.com>2024-11-21 17:06:18 +0100
committerGitHub <noreply@github.com>2024-11-21 17:06:18 +0100
commit2a53b851fee8ebaa07c1341122dd905354659237 (patch)
tree2a3a376713f82841dabaf1bf16f3fba07aeadd9f /test/integration/targets
parentansible-test - Improve container network detection (#84323) (diff)
downloadansible-2a53b851fee8ebaa07c1341122dd905354659237.tar.xz
ansible-2a53b851fee8ebaa07c1341122dd905354659237.zip
dnf5,apt: add auto_install_module_deps option (#84292)
* dnf5,apt: add auto_install_module_deps option Fixes #84206
Diffstat (limited to 'test/integration/targets')
-rw-r--r--test/integration/targets/apt/tasks/apt.yml28
-rw-r--r--test/integration/targets/dnf5/playbook.yml21
2 files changed, 39 insertions, 10 deletions
diff --git a/test/integration/targets/apt/tasks/apt.yml b/test/integration/targets/apt/tasks/apt.yml
index 64e00d3ca9..dda5fc1fab 100644
--- a/test/integration/targets/apt/tasks/apt.yml
+++ b/test/integration/targets/apt/tasks/apt.yml
@@ -8,17 +8,17 @@
distro_mirror: http://archive.ubuntu.com/ubuntu
when: ansible_distribution == 'Ubuntu'
-# UNINSTALL 'python-apt'
-# The `apt` module has the smarts to auto-install `python-apt(3)`. To test, we
-# will first uninstall `python-apt`.
-- name: uninstall python-apt with apt
+# UNINSTALL 'python3-apt'
+# The `apt` module has the smarts to auto-install `python3-apt`. To test, we
+# will first uninstall `python3-apt`.
+- name: uninstall python3-apt with apt
apt:
- pkg: [python-apt, python3-apt]
+ pkg: python3-apt
state: absent
purge: yes
register: apt_result
-# In check mode, auto-install of `python-apt` must fail
+# In check mode, auto-install of `python3-apt` must fail
- name: test fail uninstall hello without required apt deps in check mode
apt:
pkg: hello
@@ -32,13 +32,25 @@
assert:
that:
- apt_result is failed
- - '"If run normally this module can auto-install it." in apt_result.msg'
+ - '"If run normally this module can auto-install it" in apt_result.msg'
- name: check with dpkg
- shell: dpkg -s python-apt python3-apt
+ shell: dpkg -s python3-apt
register: dpkg_result
ignore_errors: true
+- name: Test the auto_install_module_deps option
+ apt:
+ pkg: hello
+ auto_install_module_deps: false
+ register: r
+ ignore_errors: true
+
+- assert:
+ that:
+ - r is failed
+ - r.msg is contains("Could not import the python3-apt module")
+
# UNINSTALL 'hello'
# With 'python-apt' uninstalled, the first call to 'apt' should install
# python-apt without updating the cache.
diff --git a/test/integration/targets/dnf5/playbook.yml b/test/integration/targets/dnf5/playbook.yml
index a1024f4b3d..a36c17a202 100644
--- a/test/integration/targets/dnf5/playbook.yml
+++ b/test/integration/targets/dnf5/playbook.yml
@@ -2,9 +2,26 @@
tasks:
- block:
- command: "dnf install -y 'dnf-command(copr)'"
- - command: dnf copr enable -y rpmsoftwaremanagement/dnf-nightly
- - command: dnf install -y -x condor python3-libdnf5
+ - name: Test against dnf5 nightly build to detect any issues early
+ command: dnf copr enable -y rpmsoftwaremanagement/dnf-nightly
+ - name: Ensure module deps are not installed
+ command: dnf remove -y python3-libdnf5
+
+ - name: Test the auto_install_module_deps option
+ dnf5:
+ name: sos
+ auto_install_module_deps: false
+ register: r
+ ignore_errors: true
+
+ - assert:
+ that:
+ - r is failed
+ - r.msg is contains("Could not import the libdnf5 python module")
+
+ # Now the first dnf5 task in the dnf role should auto install python3-libdnf5 as
+ # auto_install_module_deps is true by default.
- include_role:
name: dnf
vars: