summaryrefslogtreecommitdiffstats
path: root/.travis.yml
diff options
context:
space:
mode:
authorJeff Geerling <geerlingguy@mac.com>2017-04-01 16:13:19 -0500
committerGitHub <noreply@github.com>2017-04-01 16:13:19 -0500
commitcdd7bcd824c68209b0664ba62cf9e7b50e715d3a (patch)
tree3b3a85f35c718b69248008e252a4679c55fb8a4b /.travis.yml
parent1109fb207af21ed0a529ae03101aa521e7069dca (diff)
parentfd5694f2f65b36c394c4933a6fc4ccbc24d12830 (diff)
downloadntp-cdd7bcd824c68209b0664ba62cf9e7b50e715d3a.tar.gz
ntp-cdd7bcd824c68209b0664ba62cf9e7b50e715d3a.tar.bz2
ntp-cdd7bcd824c68209b0664ba62cf9e7b50e715d3a.tar.xz
ntp-cdd7bcd824c68209b0664ba62cf9e7b50e715d3a.zip
Merge pull request #24 from geerlingguy/test-abstraction
Test abstraction
Diffstat (limited to '.travis.yml')
-rw-r--r--.travis.yml37
1 files changed, 6 insertions, 31 deletions
diff --git a/.travis.yml b/.travis.yml
index 494f809..5e152aa 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,44 +3,19 @@ services: docker
env:
- distro: centos7
- init: /usr/lib/systemd/systemd
- run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
- distro: centos6
- init: /sbin/init
- run_opts: ""
- distro: ubuntu1604
- init: /lib/systemd/systemd
- run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
- distro: ubuntu1404
- init: /sbin/init
- run_opts: ""
- distro: ubuntu1204
- init: /sbin/init
- run_opts: ""
-
-before_install:
- # Pull container.
- - 'docker pull geerlingguy/docker-${distro}-ansible:latest'
+ # - distro: debian8
script:
- - container_id=$(mktemp)
- # Run container in detached state.
- - 'docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"'
-
- # 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'
-
- # Test role.
- - 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml'
+ # Download test shim.
+ - wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/51ef4c5aea346b3f8dd2c2518233a70dac6407d9/ansible-role-test.sh
+ - chmod +x ${PWD}/tests/test.sh
- # Test role idempotence.
- - idempotence=$(mktemp)
- - docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml | tee -a ${idempotence}
- - >
- tail ${idempotence}
- | grep -q 'changed=0.*failed=0'
- && (echo 'Idempotence test: pass' && exit 0)
- || (echo 'Idempotence test: fail' && exit 1)
+ # Run tests.
+ - ${PWD}/tests/test.sh ${distro}
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/