Skip to content

Commit

Permalink
apt: integration tests for ansible#31577 (ansible#38586)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrizek authored Apr 17, 2018
1 parent 7850dfa commit 3922b6c
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/integration/targets/apt/tasks/repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 3922b6c

Please sign in to comment.