-
Notifications
You must be signed in to change notification settings - Fork 191
/
.travis.yml
51 lines (47 loc) · 2.28 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
51
language: go
env:
matrix:
- CONSUL_VERSION: 0.6.4
- CONSUL_VERSION: 0.7.5
- CONSUL_VERSION: 0.8.5
- CONSUL_VERSION: 0.9.3
- CONSUL_VERSION: 1.0.0
- CONSUL_VERSION: 1.0.1
- CONSUL_VERSION: 1.0.2
- CONSUL_VERSION: 1.0.3
- CONSUL_VERSION: 1.0.5
- CONSUL_VERSION: 1.0.6
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:
- "ansible-playbook -i 'localhost,' -c local provision/site.yml -e \"{'ansible_eth1': {'ipv4': {'address': '192.168.10.10'}}}\" -e bootstrap_expect=1 -e consul_version=$CONSUL_VERSION"
- go get -v -t ./...
script:
# build, configure, start consul-alerts
- make build
- make test
- curl -XPUT -d @provision/fixtures/notif-profile.json 192.168.10.10:8500/v1/kv/consul-alerts/config/notif-profiles/log
- curl -XPUT -d @provision/fixtures/notif-selection.json 192.168.10.10:8500/v1/kv/consul-alerts/config/notif-selection/hosts
- curl -XPUT -d 1 192.168.10.10:8500/v1/kv/consul-alerts/config/checks/change-threshold
- build/bin/Linux-x86_64/latest/consul-alerts start --watch-events --watch-checks --consul-addr=192.168.10.10:8500 &
# install and start nomad
- wget https://releases.hashicorp.com/nomad/0.7.1/nomad_0.7.1_linux_amd64.zip
- unzip nomad_0.7.1_linux_amd64.zip
- chmod +x nomad
- sudo mv nomad /usr/local/bin/nomad
- nomad agent -dev -consul-address=192.168.10.10:8500 &
- sleep 15 # give nomad some time to start
# drop packets between nomad and consul to make the nomad service unhealthy
- sudo iptables -A INPUT -s 127.0.0.1 -p tcp --dport 4646 -j DROP
- sleep 45 # give consul-alerts some time to report
# make sure that consul-alerts reported that the service is failing
- cat /tmp/consul-notifications.log | grep "Service=nomad-client, Check=Nomad Client HTTP Check, Status=critical"
# restore the connection between nomad and consul
- sudo iptables -D INPUT -s 127.0.0.1 -p tcp --dport 4646 -j DROP
- sleep 45
# make sure that consul-alerts reported that the service is healthy
- cat /tmp/consul-notifications.log | grep "Service=nomad-client, Check=Nomad Client HTTP Check, Status=passing"