From 4ef2603a6226e68db4ff50709abd5bb7cf92e064 Mon Sep 17 00:00:00 2001 From: James Laska Date: Mon, 17 Mar 2014 10:41:02 -0400 Subject: [PATCH] Add yum+apt integration tests for auto dependency installalation The `apt` and `yum` modules will automatically install python dependencies. This change updates the existing integration tests to test whether auto-install of dependencies is functioning properly. --- test/integration/roles/test_apt/tasks/apt.yml | 20 +++++++++++++++---- test/integration/roles/test_yum/tasks/yum.yml | 17 ++++++++++++++++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/test/integration/roles/test_apt/tasks/apt.yml b/test/integration/roles/test_apt/tasks/apt.yml index 151f531359..be0facdf09 100644 --- a/test/integration/roles/test_apt/tasks/apt.yml +++ b/test/integration/roles/test_apt/tasks/apt.yml @@ -1,4 +1,19 @@ -# UNINSTALL +# UNINSTALL 'python-apt' +# The `apt` module has the smarts to auto-install `python-apt`. To test, we +# will first uninstall `python-apt`. +- name: check python-apt with dpkg + shell: dpkg -s python-apt + register: dpkg_result + ignore_errors: true + +- name: uninstall python-apt with apt + apt: pkg=python-apt state=absent purge=yes + register: apt_result + when: dpkg_result|success + +# UNINSTALL 'hello' +# With 'python-apt' uninstalled, the first call to 'apt' should install +# python-apt. - name: uninstall hello with apt apt: pkg=hello state=absent purge=yes register: apt_result @@ -8,9 +23,6 @@ failed_when: False register: dpkg_result -- debug: var=apt_result -- debug: var=dpkg_result - - name: verify uninstallation of hello assert: that: diff --git a/test/integration/roles/test_yum/tasks/yum.yml b/test/integration/roles/test_yum/tasks/yum.yml index 7c0b089ace..316b8b3a77 100644 --- a/test/integration/roles/test_yum/tasks/yum.yml +++ b/test/integration/roles/test_yum/tasks/yum.yml @@ -1,4 +1,21 @@ +# UNINSTALL 'yum-utils' +# The `yum` module has the smarts to auto-install `yum-utils`. To test, we +# will first uninstall `yum-utils`. +- name: check yum-utils with rpm + shell: rpm -q yum-utils + register: rpm_result + ignore_errors: true + +# Don't uninstall yum-utils with the `yum` module, it would be bad. The `yum` +# module does some `repoquery` magic after removing a package. It fails when you +# remove `yum-utils. +- name: uninstall yum-utils with shell + shell: yum -y remove yum-utils + when: rpm_result|success + # UNINSTALL +# With 'yum-utils' uninstalled, the first call to 'yum' should install +# yum-utils. - name: uninstall sos yum: name=sos state=removed register: yum_result