Skip to content

Commit

Permalink
Added Consul to Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeemster committed Nov 24, 2015
1 parent 973fe0d commit fe3c670
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@ install:
- godep get
- godep go build -v ./...
before_script:
- wget 'https://releases.hashicorp.com/consul/0.5.2/consul_0.5.2_linux_amd64.zip'
- unzip "consul_0.5.2_linux_amd64.zip"
- ./consul --version
- psql -c 'create database sql_runner_tests_1' -U postgres
- psql -c 'create database sql_runner_tests_2' -U postgres
script:
- ./consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul &
- sleep 5
- ./integration-tests/consul_travis.bash
- godep go test -i ./...
- godep go test ./...
- test -z "$(go fmt ./...)"
- godep go build -v
- sql-runner -playbook integration-tests/good-postgres.yml -var test_date=`date "+%Y_%m_%d"` -fromStep "Create schema and table" -consul localhost:8500
- sql-runner -playbook ./integration-tests/good-postgres.yml -var test_date=`date "+%Y_%m_%d"` -fromStep "Create schema and table"
- test "7" = "$(sql-runner -playbook ./integration-tests/bad-mixed.yml &>/dev/null; echo $?)"
- test "6" = "$(sql-runner -playbook ./integration-tests/good-postgres.yml -var test_date=`date "+%Y_%m_%d"` &>/dev/null; echo $?)"
Expand Down
14 changes: 14 additions & 0 deletions integration-tests/consul_travis.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

consul_host=http://localhost:8500
root_key=integration-tests
playbook_key=${root_key}/good-postgres.yml

## Load all key-value pairs into Consul
curl -X PUT -d "`cat ${playbook_key}`" ${consul_host}/v1/kv/${playbook_key}
curl -X PUT -d "`cat ${root_key}/postgres-sql/bad/1.sql`" ${consul_host}/v1/kv/${root_key}/postgres-sql/bad/1.sql
curl -X PUT -d "`cat ${root_key}/postgres-sql/good/1.sql`" ${consul_host}/v1/kv/${root_key}/postgres-sql/good/1.sql
curl -X PUT -d "`cat ${root_key}/postgres-sql/good/2a.sql`" ${consul_host}/v1/kv/${root_key}/postgres-sql/good/2a.sql
curl -X PUT -d "`cat ${root_key}/postgres-sql/good/2b.sql`" ${consul_host}/v1/kv/${root_key}/postgres-sql/good/2b.sql
curl -X PUT -d "`cat ${root_key}/postgres-sql/good/3.sql`" ${consul_host}/v1/kv/${root_key}/postgres-sql/good/3.sql
curl -X PUT -d "`cat ${root_key}/postgres-sql/good/assert.sql`" ${consul_host}/v1/kv/${root_key}/postgres-sql/good/assert.sql

0 comments on commit fe3c670

Please sign in to comment.