From af6f010363c0722012a9e6b5cb5ac84ca87b16ca Mon Sep 17 00:00:00 2001 From: Aleksandr Sorokoumov Date: Fri, 26 May 2017 21:57:49 +0200 Subject: [PATCH] Travis runs tests now (#188) Looks good. Super green. --- .travis.yml | 17 ++++++++++++----- Vagrantfile | 3 +++ provision/consul-server.conf.j2 | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index ac94f38..a61d795 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,14 @@ language: go + +before_install: + - sudo apt-get update -qq + - sudo apt-get install -qq python-pip python-apt + - sudo pip install ansible + # the playbook and the test require "192.168.10.10" ip address + - sudo ifconfig eth0:1 192.168.10.10 netmask 255.255.255.0 up install: - - go get github.com/AcalephStorage/consul-alerts/Godeps/_workspace/src/github.com/Sirupsen/logrus - - go get github.com/AcalephStorage/consul-alerts/Godeps/_workspace/src/github.com/docopt/docopt-go - - go get github.com/AcalephStorage/consul-alerts/Godeps/_workspace/src/github.com/imdario/mergo - - go get github.com/AcalephStorage/consul-alerts/Godeps/_workspace/src/github.com/mitchellh/hashstructure - - go get github.com/aws/aws-sdk-go/aws + - "ansible-playbook -i 'localhost,' -c local provision/site.yml -e \"{'ansible_eth1': {'ipv4': {'address': '192.168.10.10'}}}\" -e bootstrap_expect=1" + - go get -v -t ./... + +script: + - make test diff --git a/Vagrantfile b/Vagrantfile index 7a7f4bf..6c64783 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -17,6 +17,9 @@ Vagrant.configure(2) do |config| config.vm.provision :ansible do |ansible| ansible.playbook = 'provision/site.yml' + ansible.extra_vars = { + bootstrap_expect: 3 + } end end diff --git a/provision/consul-server.conf.j2 b/provision/consul-server.conf.j2 index 5c4a407..3e6b313 100644 --- a/provision/consul-server.conf.j2 +++ b/provision/consul-server.conf.j2 @@ -8,7 +8,7 @@ stop on starting shutdown export GOMAXPROCS=`nproc` # Needed on first server -bootstrap -exec /usr/local/bin/consul agent -server -bootstrap-expect 3 -config-dir /etc/consul.d -data-dir /var/lib/consul -ui-dir /opt/consul/ui -bind {{ ansible_eth1.ipv4.address }} -client 0.0.0.0 +exec /usr/local/bin/consul agent -server -bootstrap-expect {{ bootstrap_expect }} -config-dir /etc/consul.d -data-dir /var/lib/consul -ui-dir /opt/consul/ui -bind {{ ansible_eth1.ipv4.address }} -client 0.0.0.0 respawn respawn limit 10 10