2016-04-17 13:43:00 +00:00
|
|
|
# .travis.yml
|
|
|
|
---
|
|
|
|
|
|
|
|
sudo: required
|
|
|
|
env:
|
|
|
|
- >
|
2016-04-17 14:56:00 +00:00
|
|
|
DISTRIBUTION=ubuntu-upstart
|
|
|
|
DIST_VERSION=14.04
|
|
|
|
MONGODB_VERSION=3.2
|
|
|
|
- >
|
|
|
|
DISTRIBUTION=ubuntu-upstart
|
|
|
|
DIST_VERSION=14.04
|
|
|
|
MONGODB_VERSION=3.0
|
|
|
|
- >
|
|
|
|
DISTRIBUTION=ubuntu-upstart
|
|
|
|
DIST_VERSION=14.04
|
|
|
|
MONGODB_VERSION=2.6
|
2016-04-18 04:48:13 +00:00
|
|
|
- >
|
|
|
|
DISTRIBUTION=ubuntu-upstart
|
2016-05-09 09:57:26 +00:00
|
|
|
DIST_VERSION=12.04-builded
|
2016-04-18 04:48:13 +00:00
|
|
|
MONGODB_VERSION=3.2
|
|
|
|
- >
|
|
|
|
DISTRIBUTION=ubuntu-upstart
|
2016-05-09 09:57:26 +00:00
|
|
|
DIST_VERSION=12.04-builded
|
2016-04-18 04:48:13 +00:00
|
|
|
MONGODB_VERSION=3.0
|
|
|
|
- >
|
|
|
|
DISTRIBUTION=ubuntu-upstart
|
2016-05-09 09:57:26 +00:00
|
|
|
DIST_VERSION=12.04-builded
|
2016-04-18 04:48:13 +00:00
|
|
|
MONGODB_VERSION=2.6
|
2016-04-17 13:43:00 +00:00
|
|
|
|
|
|
|
services:
|
|
|
|
- docker
|
|
|
|
|
|
|
|
before_install:
|
|
|
|
- sudo apt-get update
|
|
|
|
# Latest Ansible install
|
|
|
|
- sudo apt-add-repository -y ppa:ansible/ansible
|
2016-04-17 13:47:22 +00:00
|
|
|
- sudo apt-get update
|
2016-04-17 13:43:00 +00:00
|
|
|
- sudo apt-get install ansible python-pip -y
|
2016-04-17 13:47:22 +00:00
|
|
|
- sudo pip install docker-py==1.5.0
|
2016-05-09 08:52:43 +00:00
|
|
|
# Pull docker image or build it
|
|
|
|
- >
|
|
|
|
if [ -f tests/Dockerfile.${DISTRIBUTION}_${DIST_VERSION} ]; then
|
|
|
|
sudo docker build --rm=true --file=tests/Dockerfile.${DISTRIBUTION}_${DIST_VERSION}
|
|
|
|
--tag ${DISTRIBUTION}:${DIST_VERSION} tests; else sudo docker pull ${DISTRIBUTION}:${DIST_VERSION}; fi
|
2016-04-17 13:47:22 +00:00
|
|
|
- sudo ln -s ${PWD} /etc/ansible/roles/greendayonfire.mongodb
|
2016-04-17 13:43:00 +00:00
|
|
|
|
|
|
|
script:
|
2016-04-17 15:44:11 +00:00
|
|
|
# Test 1
|
2016-05-09 08:52:43 +00:00
|
|
|
- >
|
|
|
|
sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_version=${MONGODB_VERSION}
|
|
|
|
-e image_name=${DISTRIBUTION}:${DIST_VERSION}
|
2016-04-17 13:43:00 +00:00
|
|
|
# Idempotence test
|
|
|
|
- >
|
2016-04-17 14:56:00 +00:00
|
|
|
sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_version=${MONGODB_VERSION}
|
2016-05-09 09:57:26 +00:00
|
|
|
-e image_name=${DISTRIBUTION}:${DIST_VERSION} | grep -q 'changed=0.*failed=0'
|
2016-04-17 13:43:00 +00:00
|
|
|
&& (echo 'Idempotence test: pass' && exit 0)
|
|
|
|
|| (echo 'Idempotence test: fail' && exit 1)
|
|
|
|
|
|
|
|
# Delete all containers
|
2016-04-17 13:47:22 +00:00
|
|
|
- sudo docker kill mongo{1,2,3} && docker rm mongo{1,2,3}
|
2016-04-17 15:44:11 +00:00
|
|
|
|
|
|
|
# Test 2
|
|
|
|
- >
|
2016-05-09 09:57:26 +00:00
|
|
|
sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e image_name=${DISTRIBUTION}:${DIST_VERSION}
|
2016-04-17 15:44:11 +00:00
|
|
|
-e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled'
|
|
|
|
# Idempotence test
|
|
|
|
- >
|
2016-05-09 09:57:26 +00:00
|
|
|
sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e image_name=${DISTRIBUTION}:${DIST_VERSION}
|
2016-04-17 15:44:11 +00:00
|
|
|
-e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled'
|
|
|
|
| grep -q 'changed=0.*failed=0'
|
|
|
|
&& (echo 'Idempotence test: pass' && exit 0)
|
|
|
|
|| (echo 'Idempotence test: fail' && exit 1)
|
|
|
|
|
|
|
|
# Delete all containers
|
|
|
|
- sudo docker kill mongo{1,2,3} && docker rm mongo{1,2,3}
|
|
|
|
|
|
|
|
# Test 3
|
|
|
|
- >
|
2016-05-09 09:57:26 +00:00
|
|
|
sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION}
|
2016-04-17 15:44:11 +00:00
|
|
|
-e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
|
|
|
|
# Idempotence test
|
|
|
|
- >
|
2016-05-09 09:57:26 +00:00
|
|
|
sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION}
|
2016-04-17 15:44:11 +00:00
|
|
|
-e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
|
|
|
|
| grep -q 'changed=0.*failed=0'
|
|
|
|
&& (echo 'Idempotence test: pass' && exit 0)
|
|
|
|
|| (echo 'Idempotence test: fail' && exit 1)
|
|
|
|
|
|
|
|
# Delete all containers
|
|
|
|
- sudo docker kill mongo{1,2,3} && docker rm mongo{1,2,3}
|
|
|
|
|
|
|
|
# Test 4
|
|
|
|
- >
|
2016-05-09 09:57:26 +00:00
|
|
|
sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION}
|
2016-04-17 15:44:11 +00:00
|
|
|
-e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
|
|
|
|
-e mongodb_security_authorization='enabled'
|
|
|
|
# Idempotence test
|
|
|
|
- >
|
2016-05-09 09:57:26 +00:00
|
|
|
sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION}
|
2016-04-17 15:44:11 +00:00
|
|
|
-e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
|
|
|
|
-e mongodb_security_authorization='enabled'
|
|
|
|
| grep -q 'changed=0.*failed=0'
|
|
|
|
&& (echo 'Idempotence test: pass' && exit 0)
|
|
|
|
|| (echo 'Idempotence test: fail' && exit 1)
|
|
|
|
|