From 0c1193f11da22ead4aee0778459c185c6b4e3823 Mon Sep 17 00:00:00 2001 From: Conrado Buhrer Date: Mon, 26 Jan 2015 17:57:19 -0200 Subject: [PATCH] added: integration tests builddeps for apt module --- .../roles/test_apt/tasks/apt-builddep.yml | 67 +++++++++++++++++++ .../integration/roles/test_apt/tasks/main.yml | 2 + 2 files changed, 69 insertions(+) create mode 100644 test/integration/roles/test_apt/tasks/apt-builddep.yml diff --git a/test/integration/roles/test_apt/tasks/apt-builddep.yml b/test/integration/roles/test_apt/tasks/apt-builddep.yml new file mode 100644 index 00000000000..8ed9f7e352e --- /dev/null +++ b/test/integration/roles/test_apt/tasks/apt-builddep.yml @@ -0,0 +1,67 @@ +# test installing build-deps using netcat and quilt as test victims. +# +# Deps can be discovered like so (taken from ubuntu 12.04) +# ==== +# root@localhost:~ # apt-rdepends --build-depends --follow=DEPENDS netcat +# Reading package lists... Done +# Building dependency tree +# Reading state information... Done +# netcat +# Build-Depends: debhelper (>= 8.0.0) +# Build-Depends: quilt +# root@localhost:~ # +# ==== +# Since many things depend on debhelper, let's just uninstall quilt, then +# install build-dep for netcat to get it back. build-dep doesn't have an +# uninstall, so we don't need to test for reverse actions (eg, uninstall +# build-dep and ensure things are clean) + +# uninstall quilt +- name: check quilt with dpkg + shell: dpkg -s quilt + register: dpkg_result + ignore_errors: true + tags: ['test_apt_builddep'] + +- name: uninstall quilt with apt + apt: pkg=quilt state=absent purge=yes + register: apt_result + when: dpkg_result|success + tags: ['test_apt_builddep'] + +# install build-dep for netcat +- name: install netcat build-dep with apt + apt: pkg=netcat build_dep=yes + register: apt_result + tags: ['test_apt_builddep'] + +- name: verify build_dep of netcat + assert: + that: + - "'changed' in apt_result" + tags: ['test_apt_builddep'] + +# ensure debhelper and qilt are installed +- name: check build_deps with dpkg + shell: dpkg --get-selections | egrep '(debhelper|quilt)' + failed_when: False + register: dpkg_result + tags: ['test_apt_builddep'] + +- name: verify build_deps are really there + assert: + that: + - "dpkg_result.rc == 0" + tags: ['test_apt_builddep'] + +# ensure running build-dep again doesn't yield changes +- name: install netcat build-dep with apt again + apt: pkg=netcat build_dep=yes + register: apt_result + tags: ['test_apt_builddep'] + +- name: verify build_dep of netcat did not change + assert: + that: + - "not apt_result.changed" + tags: ['test_apt_builddep'] diff --git a/test/integration/roles/test_apt/tasks/main.yml b/test/integration/roles/test_apt/tasks/main.yml index 4f2215f57ac..8976087371d 100644 --- a/test/integration/roles/test_apt/tasks/main.yml +++ b/test/integration/roles/test_apt/tasks/main.yml @@ -19,3 +19,5 @@ - include: 'apt.yml' when: ansible_distribution in ('Ubuntu', 'Debian') +- include: 'apt-builddep.yml' + when: ansible_distribution in ('Ubuntu', 'Debian')