@@ -4,83 +4,53 @@ services: docker
44env :
55 # Test source install on latest supported OSes.
66 - distro : centos7
7- init : /usr/lib/systemd/systemd
8- run_opts : " --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
97 playbook : test-source.yml
108 GIT_VERSION : 2.9.3
119 - distro : ubuntu1604
12- init : /lib/systemd/systemd
13- run_opts : " --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
1410 playbook : test-source.yml
1511 GIT_VERSION : 2.9.3
1612
1713 # Test package install on all supported OSes.
1814 - distro : centos7
19- init : /usr/lib/systemd/systemd
20- run_opts : " --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
2115 playbook : test.yml
2216 GIT_VERSION : 1.8.3.1
2317 - distro : centos6
24- init : /sbin/init
25- run_opts : " --privileged"
2618 playbook : test.yml
2719 GIT_VERSION : 1.7.1
2820 - distro : fedora24
29- init : /usr/lib/systemd/systemd
30- run_opts : " --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
3121 playbook : test.yml
3222 GIT_VERSION : 2.7.4
3323 - distro : ubuntu1604
34- init : /lib/systemd/systemd
35- run_opts : " --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
3624 playbook : test.yml
3725 GIT_VERSION : 2.7.4
3826 - distro : ubuntu1404
39- init : /sbin/init
40- run_opts : " --privileged"
4127 playbook : test.yml
4228 GIT_VERSION : 1.9.1
4329 - distro : ubuntu1204
44- init : /sbin/init
45- run_opts : " --privileged"
4630 playbook : test.yml
4731 GIT_VERSION : 1.7.9.5
4832 - distro : debian8
49- init : /lib/systemd/systemd
50- run_opts : " --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
5133 playbook : test.yml
5234 GIT_VERSION : 2.1.4
5335
54- before_install :
55- # Pull container.
56- - ' docker pull geerlingguy/docker-${distro}-ansible:latest'
57-
5836script :
59- - container_id=$(mktemp)
60- # Run container in detached state.
61- - ' docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"'
62-
63- # Ansible syntax check.
64- - ' docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook} --syntax-check'
37+ # Configure test script so we can run extra tests after playbook is run.
38+ - export container_id=$(date +%s)
39+ - export cleanup=false
6540
66- # Test role.
67- - ' docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook}'
41+ # Download test shim.
42+ - wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/
43+ - chmod +x ${PWD}/tests/test.sh
6844
69- # Test role idempotence.
70- - idempotence=$(mktemp)
71- - docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook} | tee -a ${idempotence}
72- - >
73- tail ${idempotence}
74- | grep -q 'changed=0.*failed=0'
75- && (echo 'Idempotence test: pass' && exit 0)
76- || (echo 'Idempotence test: fail' && exit 1)
45+ # Run tests.
46+ - ${PWD}/tests/test.sh
7747
7848 # Ensure Git is installed and at the right version.
79- - ' docker exec --tty "$(cat $ {container_id})" env TERM=xterm which git'
80- - ' docker exec --tty "$(cat $ {container_id})" env TERM=xterm test -x /usr/bin/git'
49+ - ' docker exec --tty $ {container_id} env TERM=xterm which git'
50+ - ' docker exec --tty $ {container_id} env TERM=xterm test -x /usr/bin/git'
8151
82- - ' docker exec --tty "$(cat $ {container_id})" env TERM=xterm git --version'
83- - ' docker exec --tty "$(cat $ {container_id})" env TERM=xterm /usr/bin/git --version | grep -qF "$GIT_VERSION"'
52+ - ' docker exec --tty $ {container_id} env TERM=xterm git --version'
53+ - ' docker exec --tty $ {container_id} env TERM=xterm /usr/bin/git --version | grep -qF "$GIT_VERSION"'
8454
8555notifications :
8656 webhooks : https://galaxy.ansible.com/api/v1/notifications/
0 commit comments