This repository has been archived by the owner on Jun 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.travis.yml
40 lines (35 loc) · 2.66 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
---
services: docker
env:
- distro=debian8 postgres_version=10
- distro=debian9 postgres_version=10
- distro=ubuntu1604 postgres_version=10
- distro=debian8 postgres_version=9.6
- distro=debian9 postgres_version=9.6
- distro=ubuntu1604 postgres_version=9.6
install:
- export container_id=$(date +%s)
- idempotence=$(mktemp)
- "printf '[defaults]\nroles_path = ../' > ansible.cfg"
# Build and run docker container
- docker pull geerlingguy/docker-$distro-ansible:latest
- docker run --detach --volume="$(dirname "$TRAVIS_BUILD_DIR")":/etc/ansible/roles:rw --name $container_id --privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro geerlingguy/docker-$distro-ansible:latest /lib/systemd/systemd
- docker exec --tty ${container_id} env TERM=xterm apt-get update -qq
- docker ps
script:
# Run playbook.
- docker exec --tty $container_id env TERM=xterm ansible-playbook /etc/ansible/roles/ansible-role-postgres/tests/test.yml --syntax-check
- docker exec $container_id env TERM=xterm env ANSIBLE_FORCE_COLOR=1 ansible-playbook /etc/ansible/roles/ansible-role-postgres/tests/test.yml -vvv -e "postgres_version=$postgres_version"
- docker exec $container_id ansible-playbook /etc/ansible/roles/ansible-role-postgres/tests/test.yml -e "postgres_version=$postgres_version" | tee -a $idempotence
- tail $idempotence | grep -q 'changed=0.*failed=0' && (printf 'Idempotence test pass') || (printf 'Idempotence test fail' && exit 1)
- docker exec $container_id su postgres -c "psql -lAt" | grep "pyslackers-website|postgres|UTF8|en_US.UTF-8|en_US.UTF-8|"
- docker exec $container_id su postgres -c "psql -lAt" | grep "sirbot|postgres|UTF8|en_US.UTF-8|en_US.UTF-8|"
- docker exec $container_id su postgres -c "psql pyslackers-website -c '\l pyslackers-website'" | grep '"pyslackers-website"=C/postgres'
- docker exec $container_id cat /etc/postgresql/$postgres_version/main/postgresql.conf | grep 'port = 5555'
- docker exec $container_id cat /etc/postgresql/$postgres_version/main/postgresql.conf | grep "listen_addresses = '127.0.0.1'"
- docker exec $container_id cat /etc/postgresql/$postgres_version/main/pg_hba.conf | grep 'sirbot'
- docker exec $container_id cat /etc/postgresql/$postgres_version/main/pg_hba.conf | grep 'pyslackers-website'
- docker exec --tty ${container_id} env TERM=xterm journalctl -u postgresql.service -n 200 --no-pager
- docker exec --tty ${container_id} env TERM=xterm ls -la /var/run/postgresql | grep $postgres_version
- docker exec --tty ${container_id} env TERM=xterm cat /etc/postgresql/$postgres_version/main/postgresql.conf
- docker exec --tty ${container_id} env TERM=xterm cat /var/log/postgresql/postgresql-$postgres_version-main.log