Skip to content

Commit

Permalink
New test structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Arslanbekov Denis committed Jan 16, 2018
1 parent 8f57cfc commit ad9b78a
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 48 deletions.
43 changes: 26 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
---
services: docker
language: python
python: "2.7"
sudo: required
dist: trusty
services:
- docker

env:
- distro: centos7
- distro: ubuntu1604
- distro: ubuntu1404
- distro: debian8
before_install:
- sudo apt-get update -qq

script:
# Configure test script so we can run extra tests after playbook is run.
- export container_id=$(date +%s)

# Download test shim.
- wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/
- chmod +x ${PWD}/tests/test.sh

# Run tests.
- ${PWD}/tests/test.sh
install:
- sudo pip install docker-py
- sudo apt-get install -y sshpass software-properties-common python-software-properties
- sudo apt-add-repository -y ppa:ansible/ansible
- sudo apt-get update -qq
- sudo apt-get install -y ansible
- echo -e 'localhost ansible_connection=local' > tests/inventory
- echo -e '[defaults]\nroles_path = ../\nhostfile = ./tests/inventory' > ansible.cfg
- sudo rm /usr/bin/python && sudo ln -s /usr/bin/python2.7 /usr/bin/python
- ansible --version

script:
- ansible-playbook --syntax-check tests/role.yml
- ansible-playbook -v --diff tests/role.yml
- >
ansible-playbook tests/role.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
notifications:
email: false
webhooks: https://galaxy.ansible.com/api/v1/notifications/
11 changes: 0 additions & 11 deletions tests/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions tests/requirements.yml

This file was deleted.

5 changes: 5 additions & 0 deletions tests/role.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: 'localhost'
roles:
- role: 'gridrouter-docker'
become: yes
1 change: 1 addition & 0 deletions tests/test-local-inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
localhost ansible_connection=local ansible_python_interpreter=/usr/local/bin/python
5 changes: 5 additions & 0 deletions tests/test-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- { role: ../../gridrouter-docker }
16 changes: 0 additions & 16 deletions tests/test.yml

This file was deleted.

0 comments on commit ad9b78a

Please sign in to comment.