Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding vendor dependencies and updating tests to run in docker #29

Merged
merged 3 commits into from
Nov 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 12 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
sudo: false
language: go
sudo: true
services:
- docker

go:
- 1.3
- 1.4
- 1.5
- tip
env:
- GO_VERSION="1.6"
- GO_VERSION="1.7"
- GO_VERSION="latest"

before_install:
- curl -L https://github.com/docker/compose/releases/download/1.8.1/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin

addons:
postgresql: "9.3"

before_script:
- export DEFAULT_TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR
- export TRAVIS_BUILD_DIR=$HOME/gopath/src/gopkg.in/doug-martin/goqu.v3
- mkdir -p $TRAVIS_BUILD_DIR
- rm -rf $TRAVIS_BUILD_DIR
- mv -vfT $DEFAULT_TRAVIS_BUILD_DIR $TRAVIS_BUILD_DIR
- psql -c 'create database goqupostgres;' -U postgres
- mysql -e 'create database goqumysql;'

script: go test -v -race ./...
script: docker-compose run goqu
13 changes: 5 additions & 8 deletions adapters/mysql/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,13 @@ const (
"(9, 0.900000, '0.900000', '2015-02-23 03:19:55', FALSE, '0.900000');"
)

var db_uri = "root@/goqumysql?parseTime=true"
const default_db_uri = "root@/goqumysql?parseTime=true"
var db_uri string

func init() {
uri := os.Getenv("WERCKER_MYSQL_URL")
if uri != "" {
user := os.Getenv("WERCKER_MYSQL_USERNAME")
pass := os.Getenv("WERCKER_MYSQL_PASSWORD")
addr := os.Getenv("WERCKER_MYSQL_HOST") + ":" + os.Getenv("WERCKER_MYSQL_PORT")
dbname := os.Getenv("WERCKER_MYSQL_DATABASE")
db_uri = fmt.Sprintf("%s:%s@tcp(%s)/%s?timeout=30s&parseTime=true", user, pass, addr, dbname)
db_uri = os.Getenv("MYSQL_URI")
if db_uri == "" {
db_uri = default_db_uri
}
}

Expand Down
9 changes: 5 additions & 4 deletions adapters/postgres/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ const schema = `
(9, 0.900000, '0.900000', '2015-02-23T03:19:55.000000000-00:00', FALSE, '0.900000');
`

var db_uri = "postgres://postgres:@/goqupostgres?sslmode=disable"
const default_db_uri ="postgres://postgres:@/goqupostgres?sslmode=disable"
var db_uri string

func init() {
uri := os.Getenv("WERCKER_POSTGRESQL_URL")
if uri != "" {
db_uri = uri
db_uri = os.Getenv("PG_URI")
if db_uri == "" {
db_uri = default_db_uri
}
}

Expand Down
22 changes: 17 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,25 @@ services:
environment:
- "POSTGRES_USER=postgres"
- "POSTGRES_DB=goqupostgres"
ports:
- "5432:5432"
expose:
- "5432"

mysql:
image: mysql:8.0
image: mysql:5
environment:
- "MYSQL_DATABASE=goqumysql"
- "MYSQL_ALLOW_EMPTY_PASSWORD=yes"
ports:
- "3306:3306"
expose:
- "3306"

goqu:
image: "golang:${GO_VERSION}"
command: bash -c "sleep 30 && go test -v -race ./..."
volumes:
- "./:/go/src/gopkg.in/doug-martin/goqu.v3"
environment:
MYSQL_URI: 'root@tcp(mysql:3306)/goqumysql?parseTime=true'
PG_URI: 'postgres://postgres:@postgres:5432/goqupostgres?sslmode=disable'
depends_on:
- postgres
- mysql
9 changes: 9 additions & 0 deletions vendor/github.com/c2fo/testify/LICENCE.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading