Skip to content
Permalink
Browse files

chore: create an integration user before calling the integration script

  • Loading branch information...
moul committed May 23, 2019
1 parent a6fc902 commit 0f914694619a1d1f4180bfe714050011db8cfd4c
Showing with 15 additions and 7 deletions.
  1. +1 −0 .dockerignore
  2. +4 −2 Makefile
  3. +9 −5 docker-compose.yml
  4. +1 −0 sql/sql.go
@@ -11,3 +11,4 @@ Dockerfile
vendor/
.gitignore
.dockerignore
docker-compose.yml
@@ -136,8 +136,10 @@ integration.build:
.PHONY:integration.run
integration.run:
docker-compose up -d --no-build server
docker-compose run server "./wait-for-it.sh mysql:3306 -- echo server ready"
docker-compose run server "pathwar.pw sql adduser --sql-config=$$SQL_CONFIG --email=integration@example.com --username=integration --password=integration"
docker-compose exec server ./wait-for-it.sh mysql:3306 -- echo mysql ready
docker-compose exec server ./wait-for-it.sh localhost:9111 -- echo gRPC ready
sleep 5
docker-compose exec server pathwar.pw sql adduser --sql-config=$$SQL_CONFIG --email=integration@example.com --username=integration --password=integration
docker-compose run web npm test

.PHONY: lint
@@ -1,16 +1,20 @@
version: '3'
version: '2.3'

services:
server:
image: pathwar/pathwar:latest
build: .
entrypoint:
- "/bin/bash"
- "-c"
- ./wait-for-it.sh
- mysql:3306
- "--"
environment:
- SQL_CONFIG='root:uns3cur3@tcp(mysql:3306)/pathwar?charset=utf8&parseTime=true'
- SQL_CONFIG=root:uns3cur3@tcp(mysql:3306)/pathwar?charset=utf8&parseTime=true
command:
- "./wait-for-it.sh mysql:3306 -- /bin/pathwar.pw server --http-bind=0.0.0.0:8000 --grpc-bind=0.0.0.0:9111"
- /bin/pathwar.pw
- server
- --http-bind=0.0.0.0:8000
- --grpc-bind=0.0.0.0:9111
depends_on:
- mysql
ports:
@@ -20,6 +20,7 @@ func FromOpts(opts *Options) (*gorm.DB, error) {
if envConfig := os.Getenv("SQL_CONFIG"); envConfig != "" { // this should be done using viper's built-in env support
sqlConfig = envConfig
}
zap.L().Debug("opening sql", zap.String("config", sqlConfig))
db, err := gorm.Open("mysql", sqlConfig)
if err != nil {
return nil, err

0 comments on commit 0f91469

Please sign in to comment.
You can’t perform that action at this time.