summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/apt
diff options
context:
space:
mode:
authorMartin Krizek <martin.krizek@gmail.com>2018-04-17 10:17:29 +0200
committerGitHub <noreply@github.com>2018-04-17 10:17:29 +0200
commit3922b6cc93af716636bd5fada454b1799192e21a (patch)
tree443d0817f8798441a9565f89ba9af2660ebcab1e /test/integration/targets/apt
parent[fix] issue #30638 - onlyupgrade handling (#31577) (diff)
downloadansible-3922b6cc93af716636bd5fada454b1799192e21a.tar.xz
ansible-3922b6cc93af716636bd5fada454b1799192e21a.zip
apt: integration tests for #31577 (#38586)
Diffstat (limited to 'test/integration/targets/apt')
-rw-r--r--test/integration/targets/apt/tasks/repo.yml38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/integration/targets/apt/tasks/repo.yml b/test/integration/targets/apt/tasks/repo.yml
index d38f8f6759..af2613e2db 100644
--- a/test/integration/targets/apt/tasks/repo.yml
+++ b/test/integration/targets/apt/tasks/repo.yml
@@ -141,6 +141,44 @@
that:
- "autoclean_result is not changed"
+ # https://github.com/ansible/ansible/issues/30638
+ - name: Fail to install foo=1.0.1 since foo is not installed and only_upgrade is set
+ apt:
+ name: foo=1.0.1
+ state: installed
+ only_upgrade: yes
+ allow_unauthenticated: yes
+ ignore_errors: yes
+ register: apt_result
+
+ - name: Check that foo was not upgraded
+ assert:
+ that:
+ - "apt_result is not changed"
+
+ - apt:
+ name: foo=1.0.0
+ allow_unauthenticated: yes
+
+ - name: Upgrade foo to 1.0.1
+ apt:
+ name: foo=1.0.1
+ state: installed
+ only_upgrade: yes
+ allow_unauthenticated: yes
+ register: apt_result
+
+ - name: Check install with dpkg
+ shell: dpkg-query -l foo
+ register: dpkg_result
+
+ - name: Check if install was successful
+ assert:
+ that:
+ - "apt_result is success"
+ - "dpkg_result is success"
+ - "'1.0.1' in dpkg_result.stdout"
+
always:
- name: Clean up
apt: