Skip to content

Commit

Permalink
Merge pull request #3 from iqoption/add-travis
Browse files Browse the repository at this point in the history
Add test case / travis-ci
  • Loading branch information
arslanbekov authored Jan 16, 2018
2 parents b76fb02 + e30e798 commit 16ca384
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 7 deletions.
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
language: python
python: "2.7"
sudo: required
dist: trusty
services:
- docker

before_install:
- sudo apt-get update -qq

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:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## GridRouter in docker
[![Build Status](https://travis-ci.org/iqoption/gridrouter-docker.svg?branch=add-travis)](https://travis-ci.org/iqoption/gridrouter-docker)

Set up [GridRouter](https://github.com/aerokube/ggr) in docker

Expand Down
15 changes: 15 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,18 @@ galaxy_info:
- name: Ubuntu
versions:
- 16.04
- name: EL
versions:
- 6
- name: Debian
versions:
- jessie
- name: Ubuntu
versions:
- trusty
- xenial
galaxy_tags:
- containers
- docker
- selenoid
- gridrouter
13 changes: 6 additions & 7 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
- name: Grid Router | Installing docker-py python package
pip: name=docker-py
- name: Grid Router | Install certain python modules for docker
pip:
name: "{{ item.name }}"
with_items:
- { name: docker-py }
- { name: passlib }

- name: Grid Router | Download sctl
get_url:
Expand All @@ -25,9 +29,6 @@
args:
creates: "{{ grid_router_qouta_path }}/selenoid.xml"

- name: Grid Router | Make sure we can use htpasswd module
apt: "pkg=python-passlib state=installed"

- name: Grid Router | Setup quota password
htpasswd:
path: "{{ grid_router_gr_path }}/users.htpasswd"
Expand All @@ -42,8 +43,6 @@
image: "aerokube/ggr:{{ grid_router_version }}"
network_mode: host
state: started
env:
DOCKER_API_VERSION: "{{ grid_router_docker_api_version }}"
volumes:
- "{{ grid_router_gr_path }}:{{ grid_router_gr_path }}:ro"
ports:
Expand Down
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 }

0 comments on commit 16ca384

Please sign in to comment.