2016-10-30 20:40:48 +01:00
|
|
|
---
|
|
|
|
dist: trusty
|
|
|
|
language: python
|
|
|
|
python: "2.7"
|
|
|
|
before_install:
|
|
|
|
- sudo apt-get update -qq
|
|
|
|
- sudo apt-get install -qq python-apt python-pycurl
|
2017-01-07 09:55:05 +01:00
|
|
|
- "[ -f get-dependencies.sh ] && sh -x get-dependencies.sh"
|
2016-10-30 20:40:48 +01:00
|
|
|
## for local travis execution as we use same default.yml than kitchen
|
|
|
|
- mkdir /tmp/kitchen
|
2016-10-30 21:00:09 +01:00
|
|
|
- ln -s /home/travis/build/juju4/ansible-fprobe/test/integration/default/tmp /tmp/kitchen/tmp
|
2016-10-30 20:40:48 +01:00
|
|
|
## serverspec test
|
|
|
|
- sudo apt-get install -qq ruby2.0 rake
|
|
|
|
- sudo gem2.0 install serverspec
|
2016-10-30 21:00:09 +01:00
|
|
|
- ln -s /home/travis/build/juju4/ansible-fprobe/test/integration/default/serverspec/Rakefile
|
2016-10-30 20:40:48 +01:00
|
|
|
install:
|
|
|
|
- pip install ansible
|
|
|
|
- ansible --version
|
|
|
|
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"
|
|
|
|
- gem2.0 --version
|
|
|
|
script:
|
2019-06-09 18:25:51 +02:00
|
|
|
- "echo \"localhost\" > inventory"
|
2016-10-30 20:40:48 +01:00
|
|
|
|
|
|
|
# Check the role/playbook's syntax.
|
|
|
|
- "ansible-playbook -i inventory --syntax-check test/integration/default/default.yml"
|
|
|
|
|
|
|
|
# Run the role/playbook with ansible-playbook.
|
|
|
|
- "ansible-playbook -i inventory --connection=local --sudo -vvvv test/integration/default/default.yml"
|
|
|
|
|
|
|
|
# Run the role/playbook again, checking to make sure it's idempotent.
|
2016-10-30 21:00:09 +01:00
|
|
|
## known fail - ensure service is enabled and started
|
|
|
|
- "ansible-playbook -i inventory test/integration/default/default.yml --connection=local --sudo | tee /tmp/idempotency.log | grep -q 'changed=0.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && cat /tmp/idempotency.log && exit 0)"
|
2016-10-30 20:40:48 +01:00
|
|
|
|
|
|
|
# Serverspec
|
|
|
|
# - "test/integration/default/serverspec/run-local-tests.sh"
|
|
|
|
- "cd test/integration/default/serverspec/ && bundle exec rake spec"
|