-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.travis.yml
61 lines (44 loc) · 1.41 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
# Travis file for shinken role
dist: trusty
sudo: required
services:
- docker
language: ruby
rvm:
- 2.1.5
env:
- ANSIBLE_ROLES_PATH="${TRAVIS_BUILD_DIR%/*/*}"
before_install:
# Make sure everything's up to date.
- sudo apt-get update -qq
# Install ruby dependencies to run serverspec tests
- rvmsudo gem install serverspec rspec
# Install Ansible and pytest.
- sudo pip install ansible paramiko PyYAML Jinja2 httplib2 six pytest
# Remove rvmsudo warning
- >
[[ $(sudo grep secure_path /etc/sudoers) ]]
&& export rvmsudo_secure_path=1 || export rvmsudo_secure_path=0
install:
# Add ansible.cfg to pick up roles path.
- "cp ./tests/ansible.cfg ./"
script:
# Check the role/playbook's syntax.
- ansible-playbook -i tests/inventory tests/test_travis.yml --syntax-check
# Run filter plugins tests
- py.test -v
# Run the role/playbook with ansible-playbook.
- >
ansible-playbook -i tests/inventory tests/test_travis.yml
--connection=local --sudo
# Run the role/playbook again, checking to make sure it's idempotent.
# Set change=1 due to a bug in ansible service module always return changed
- >
ansible-playbook -i tests/inventory tests/test_travis.yml
--connection=local --sudo
| grep -q 'changed=[0].*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Run serverspec tests
- rvmsudo rspec