-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
.travis.yml
50 lines (41 loc) · 1.51 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
---
language: python
python: "2.7"
sudo: required
env:
- PLAYBOOK=test.yml
before_install:
# Remove any MySQL package to ensure a clean starting state
- sudo apt-get remove --purge 'mysql*'
- sudo apt-get autoremove
- sudo apt-get autoclean
- sudo rm -rf /var/lib/mysql
- sudo truncate -s 0 /var/log/mysql/error.log
install:
# Install Ansible.
- pip install ansible
# Add ansible.cfg to pick up roles path.
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"
script:
# Check the role/playbook's syntax.
- "ansible-playbook -i tests/inventory tests/$PLAYBOOK --syntax-check"
# Run the role/playbook with ansible-playbook.
- "ansible-playbook -i tests/inventory tests/$PLAYBOOK --connection=local --become"
# Run the role/playbook again, checking to make sure it's idempotent.
- >
ansible-playbook -i tests/inventory tests/$PLAYBOOK --connection=local --become
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Check to make sure we can connect to MySQL via Unix socket.
- >
mysql -u root -proot -e 'show databases;'
| grep -q 'performance_schema'
&& (echo 'MySQL running normally' && exit 0)
|| (echo 'MySQL not running' && exit 1)
# Check to make sure we can connect to MySQL via TCP.
- >
mysql -u root -proot -h 127.0.0.1 -e 'show databases;'
| grep -q 'performance_schema'
&& (echo 'MySQL running normally' && exit 0)
|| (echo 'MySQL not running' && exit 1)