From 61cf403dd97e43c16e05dc0dd03694df1543574f Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sat, 1 Apr 2017 15:05:50 -0500 Subject: Add test shim and update Travisfile. --- .travis.yml | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 494f809..5ea940f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,44 +3,18 @@ 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' 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' - - # 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/ -- cgit v1.2.1 From 27b71feaa79024126033f4410205804b3c657399 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sat, 1 Apr 2017 15:53:03 -0500 Subject: Optimize installation, make things work better. --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 5ea940f..1f2c376 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,7 @@ env: - distro: ubuntu1604 - distro: ubuntu1404 - distro: ubuntu1204 - -before_install: - # Pull container. - - 'docker pull geerlingguy/docker-${distro}-ansible:latest' + - distro: debian8 script: # Run tests. -- cgit v1.2.1 From bbe9066d500b3c7c37bb5280e4280d46f055b525 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sat, 1 Apr 2017 16:02:12 -0500 Subject: Final adjustments. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index 1f2c376..a829b5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ env: - distro: ubuntu1604 - distro: ubuntu1404 - distro: ubuntu1204 - - distro: debian8 + # - distro: debian8 script: # Run tests. -- cgit v1.2.1 From 7a748c8d71428ec6161d4b055accd2b6853ac3ee Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sat, 1 Apr 2017 16:07:28 -0500 Subject: Add gitignore and use shipping test.sh. --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) (limited to '.travis.yml') diff --git a/.travis.yml b/.travis.yml index a829b5f..5e152aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,10 @@ env: # - distro: debian8 script: + # 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 + # Run tests. - ${PWD}/tests/test.sh ${distro} -- cgit v1.2.1