summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSloane Hertel <19572925+s-hertel@users.noreply.github.com>2022-09-15 18:24:39 -0400
committerGitHub <noreply@github.com>2022-09-15 18:24:39 -0400
commitf26f3325ba625e57b41049fcf75f6d74e587d23e (patch)
treed96fc4a54c25c6bb45296765f17e586f6565f1dd /test
parent7683c0ae5435808b4fff46a6d9c7d6ff755210c4 (diff)
downloadansible-f26f3325ba625e57b41049fcf75f6d74e587d23e.tar.gz
apt - fix module short-circuiting when a package is not installed and only_upgrade is True (#78790)
Diffstat (limited to 'test')
-rw-r--r--test/integration/targets/apt/tasks/repo.yml18
1 files changed, 12 insertions, 6 deletions
diff --git a/test/integration/targets/apt/tasks/repo.yml b/test/integration/targets/apt/tasks/repo.yml
index 40d30e2a01..d4cce78a1b 100644
--- a/test/integration/targets/apt/tasks/repo.yml
+++ b/test/integration/targets/apt/tasks/repo.yml
@@ -54,7 +54,7 @@
# https://github.com/ansible/ansible/issues/30638
- block:
- - name: Do nothing to install foo=1.0.1 since foo is not installed and only_upgrade is set
+ - name: Don't install foo=1.0.1 since foo is not installed and only_upgrade is set
apt:
name: foo=1.0.1
state: present
@@ -73,24 +73,30 @@
name: foo=1.0.0
allow_unauthenticated: yes
- - name: Upgrade foo to 1.0.1
+ - name: Upgrade foo to 1.0.1 but don't upgrade foobar since it is not installed
apt:
- name: foo=1.0.1
+ name: foobar=1.0.1,foo=1.0.1
state: present
only_upgrade: yes
allow_unauthenticated: yes
register: apt_result
- name: Check install with dpkg
- shell: dpkg-query -l foo
+ shell: "dpkg-query -l {{ item }}"
register: dpkg_result
+ ignore_errors: yes
+ loop:
+ - foobar
+ - foo
- name: Check if install was successful
assert:
that:
- "apt_result is success"
- - "dpkg_result is success"
- - "'1.0.1' in dpkg_result.stdout"
+ - "dpkg_result.results[0] is failure"
+ - "'1.0.1' not in dpkg_result.results[0].stdout"
+ - "dpkg_result.results[1] is success"
+ - "'1.0.1' in dpkg_result.results[1].stdout"
always:
- name: Clean up
apt: