@@ -3,53 +3,27 @@ services: docker
3
3
4
4
env :
5
5
- distro : centos7
6
- init : /usr/lib/systemd/systemd
7
- run_opts : " --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
8
6
- distro : centos6
9
- init : /sbin/init
10
- run_opts : " "
11
7
- distro : fedora24
12
- init : /usr/lib/systemd/systemd
13
- run_opts : " --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
14
8
- distro : ubuntu1604
15
- init : /lib/systemd/systemd
16
- run_opts : " --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
17
9
- distro : ubuntu1404
18
- init : /sbin/init
19
- run_opts : " "
20
10
- distro : ubuntu1204
21
- init : /sbin/init
22
- run_opts : " "
23
11
- distro : debian8
24
- init : /lib/systemd/systemd
25
- run_opts : " --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
26
-
27
- before_install :
28
- # Pull container.
29
- - ' docker pull geerlingguy/docker-${distro}-ansible:latest'
30
12
31
13
script :
32
- - container_id=$(mktemp)
33
- # Run container in detached state.
34
- - ' docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"'
35
-
36
- # Ansible syntax check.
37
- - ' docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check'
14
+ # Configure test script so we can run extra tests after playbook is run.
15
+ - export container_id=$(date +%s)
16
+ - export cleanup=false
38
17
39
- # Test role.
40
- - ' docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml'
18
+ # Download test shim.
19
+ - wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/
20
+ - chmod +x ${PWD}/tests/test.sh
41
21
42
- # Test role idempotence.
43
- - idempotence=$(mktemp)
44
- - docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml | tee -a ${idempotence}
45
- - >
46
- tail ${idempotence}
47
- | grep -q 'changed=0.*failed=0'
48
- && (echo 'Idempotence test: pass' && exit 0)
49
- || (echo 'Idempotence test: fail' && exit 1)
22
+ # Run tests.
23
+ - ${PWD}/tests/test.sh
50
24
51
25
# Ensure Java is installed.
52
- - ' docker exec --tty "$(cat $ {container_id})" env TERM=xterm which java'
26
+ - ' docker exec --tty $ {container_id} env TERM=xterm which java'
53
27
54
28
notifications :
55
29
webhooks : https://galaxy.ansible.com/api/v1/notifications/
0 commit comments