From 1f8931618270b86051e6586c1d4db5936285ff0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Sch=C3=B6ldstr=C3=B6m?= Date: Sun, 19 Mar 2017 10:43:53 -0500 Subject: [PATCH] Fix Centos6 tests by testing source install --- .travis.yml | 11 ++++++++--- tests/test-source-install.yml | 14 ++++++++++++++ tests/test.yml | 1 - 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 tests/test-source-install.yml diff --git a/.travis.yml b/.travis.yml index 1ee8c0a..d8206d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,18 +5,23 @@ env: - distro: centos7 init: /usr/lib/systemd/systemd run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" + playbook: test.yml - distro: centos6 init: /sbin/init run_opts: "" + playbook: test-source-install.yml - distro: ubuntu1604 init: /lib/systemd/systemd run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" + playbook: test.yml - distro: ubuntu1404 init: /sbin/init run_opts: "" + playbook: test.yml - distro: ubuntu1204 init: /sbin/init run_opts: "" + playbook: test.yml before_install: # Pull container. @@ -31,14 +36,14 @@ script: - 'docker exec "$(cat ${container_id})" ansible-galaxy install -r /etc/ansible/roles/role_under_test/tests/requirements.yml' # Ansible syntax check. - - 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check' + - 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook} --syntax-check' # Test role. - - 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml' + - 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook}' # Test role idempotence. - idempotence=$(mktemp) - - docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml | tee -a ${idempotence} + - docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook} | tee -a ${idempotence} - > tail ${idempotence} | grep -q 'changed=0.*failed=0' diff --git a/tests/test-source-install.yml b/tests/test-source-install.yml new file mode 100644 index 0000000..697df9c --- /dev/null +++ b/tests/test-source-install.yml @@ -0,0 +1,14 @@ +--- +- hosts: all + + vars: + certbot_install_from_source: yes + + pre_tasks: + - name: Install cron (RedHat). + yum: name=cronie state=present + when: ansible_os_family == 'RedHat' + + roles: + - geerlingguy.git + - role_under_test diff --git a/tests/test.yml b/tests/test.yml index cf90f58..217fc45 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -16,5 +16,4 @@ when: ansible_os_family == 'Debian' roles: - - geerlingguy.git - role_under_test