File tree Expand file tree Collapse file tree 3 files changed +19
-6
lines changed Expand file tree Collapse file tree 3 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 56
56
- checkout
57
57
- run :
58
58
name : Integration Test
59
- command : MIGRATIONS_DIR=$(pwd)/pkg/configs/db /migrations make BUILD_IN_CONTAINER=false configs-integration-test
59
+ command : MIGRATIONS_DIR=$(pwd)/cmd/cortex /migrations make BUILD_IN_CONTAINER=false configs-integration-test
60
60
61
61
build :
62
62
<< : *defaults
Original file line number Diff line number Diff line change @@ -101,9 +101,9 @@ configs-integration-test: build-image/$(UPTODATE)
101
101
-v $(shell pwd) /.pkg:/go/pkg \
102
102
-v $(shell pwd) :/go/src/github.com/cortexproject/cortex \
103
103
-v $(shell pwd) /cmd/cortex/migrations:/migrations \
104
- -e MIGRATIONS_DIR=/migrations \
105
104
--workdir /go/src/github.com/cortexproject/cortex \
106
105
--link " $$ DB_CONTAINER" :configs-db.cortex.local \
106
+ -e DB_ADDR=configs-db.cortex.local \
107
107
$(IMAGE_PREFIX ) build-image $@ ; \
108
108
status=$$? ; \
109
109
test -n " $( CIRCLECI) " || docker rm -f " $$ DB_CONTAINER" ; \
@@ -136,7 +136,7 @@ shell:
136
136
bash
137
137
138
138
configs-integration-test :
139
- /bin/bash -c " go test -tags 'netgo integration' -timeout 30s ./pkg/configs/... ./pkg/ruler/..."
139
+ /bin/bash -c " go test -v - tags 'netgo integration' -timeout 30s ./pkg/configs/... ./pkg/ruler/..."
140
140
141
141
mod-check :
142
142
GO111MODULE=on go mod download
@@ -167,7 +167,7 @@ load-images:
167
167
fi \
168
168
done
169
169
170
- # Loads the built Docker images into the minikube environmen , and tags them with
170
+ # Loads the built Docker images into the minikube environment , and tags them with
171
171
# "latest" so the k8s manifests shipped with this code work.
172
172
prime-minikube : save-images
173
173
eval $$(minikube docker-env ) ; \
Original file line number Diff line number Diff line change @@ -16,16 +16,29 @@ import (
16
16
17
17
var (
18
18
done chan error
19
+ dbAddr string
20
+ migrationsDir string
19
21
errRollback = fmt .Errorf ("Rolling back test data" )
20
- migrationsDir = os .Getenv ("MIGRATIONS_DIR" )
21
22
)
22
23
24
+ func init () {
25
+ dbAddr = os .Getenv ("DB_ADDR" )
26
+ if dbAddr == "" {
27
+ dbAddr = "127.0.0.1"
28
+ }
29
+
30
+ migrationsDir = os .Getenv ("MIGRATIONS_DIR" )
31
+ if migrationsDir == "" {
32
+ migrationsDir = "/migrations"
33
+ }
34
+ }
35
+
23
36
// Setup sets up stuff for testing, creating a new database
24
37
func Setup (t * testing.T ) db.DB {
25
38
require .NoError (t , logging .Setup ("debug" ))
26
39
// Don't use db.MustNew, here so we can do a transaction around the whole test, to rollback.
27
40
pg , err := postgres .New (
28
- "postgres://postgres@127.0.0.1 /configs_test?sslmode=disable" ,
41
+ fmt . Sprintf ( "postgres://postgres@%s /configs_test?sslmode=disable" , dbAddr ) ,
29
42
migrationsDir ,
30
43
)
31
44
require .NoError (t , err )
You can’t perform that action at this time.
0 commit comments