This repository has been archived by the owner on Feb 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
66 lines (55 loc) · 2.21 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
61
62
63
64
65
66
---
language: python
python: "2.7"
dist: trusty
# before_install:
# - "echo OK"
env:
- SITE=test.yml
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
addons:
hosts:
- supervhost.local
- supervhost.proxy
install:
- "pip install ansible"
# Add ansible.cfg to pick up roles path.
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"
- "mkdir -p /opt/defaultvhost"
- "mkdir -p /opt/supervhost"
- "mkdir -p /opt/testlocation"
- "echo '<html><body>default</body></html>'> /opt/defaultvhost/index.html"
- "echo '<html><body>supervhost</body></html>' > /opt/supervhost/index.html"
- "echo '<html><body>supervhost testlocation</body></html>' > /opt/testlocation/index.html"
script:
# Check the role/playbook's syntax.
- "ansible-playbook -i tests/inventory tests/$SITE --syntax-check"
# Run the role/playbook with ansible-playbook.
- "ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo"
# Run the role/playbook again, checking to make sure it's idempotent.
- >
ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Check service : default vhost
- >
curl -L http://localhost/ 2>/dev/null | grep -q 'default'
&& (echo 'local vhost serve index test: pass' && exit 0)
|| (echo 'local vhost serve index test: fail' && exit 1)
# Check service : local vhost
- >
curl -L http://supervhost.local:8080/ 2>/dev/null | grep -q 'supervhost'
&& (echo 'local vhost serve index test: pass' && exit 0)
|| (echo 'local vhost serve index test: fail' && exit 1)
# Check service : rproxied vhost
- >
curl -L http://supervhost.proxy/ 2>/dev/null | grep -q 'supervhost'
&& (echo 'proxied vhost serve index test: pass' && exit 0)
|| (echo 'proxied vhost serve index test: fail' && exit 1)
# Check service : rproxied vhost backend location
- >
curl -L http://supervhost.proxy/testlocation/ 2>/dev/null | grep -q 'testlocation'
&& (echo 'proxied vhost backend location test: pass' && exit 0)
|| (echo 'proxied vhost backend location test: fail' && exit 1)