Skip to content

Commit 2220271

Browse files
mboersmaGabriel Monroy
authored andcommitted
fix(tests): improve functional test setup logic
1 parent 5bc1c80 commit 2220271

12 files changed

Lines changed: 32 additions & 28 deletions

File tree

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ discovery-url:
1919
sed -i .orig -e "s,# discovery: https://discovery.etcd.io/12345693838asdfasfadf13939923,discovery: $$(curl -q -w '\n' https://discovery.etcd.io/new)," contrib/coreos/user-data
2020

2121
build: check-docker
22-
@$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) build ;)
22+
@$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) build || exit 1;)
2323

2424
push: check-docker check-registry
25-
@$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) push ;)
26-
25+
@$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) push || exit 1;)
26+
2727
full-clean:
28-
@$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) full-clean ;)
28+
@$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) full-clean || exit 1;)
2929

3030
install:
31-
@$(foreach C, $(START_ORDER), $(MAKE) -C $(C) install ;)
31+
@$(foreach C, $(START_ORDER), $(MAKE) -C $(C) install || exit 1;)
3232

3333
uninstall:
34-
@$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) uninstall ;)
34+
@$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) uninstall || exit 1;)
3535

3636
start:
37-
@$(foreach C, $(START_ORDER), $(MAKE) -C $(C) start ;)
37+
@$(foreach C, $(START_ORDER), $(MAKE) -C $(C) start || exit 1;)
3838

3939
stop:
40-
@$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) stop ;)
40+
@$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) stop || exit 1;)
4141

4242
restart: stop start
4343

builder/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ test-unit:
4040
@echo no unit tests
4141

4242
test-functional:
43-
@docker history deis/test-etcd >/dev/null 2>&1 || docker pull deis/test-etcd
44-
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -v -timeout 30m ./tests/...
43+
@docker history deis/test-etcd >/dev/null 2>&1 || docker pull deis/test-etcd:latest
44+
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -v ./tests/...

cache/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ test-unit:
3838
@echo no unit tests
3939

4040
test-functional:
41-
@docker history deis/test-etcd >/dev/null 2>&1 || docker pull deis/test-etcd
42-
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -v -timeout 20m ./tests/...
41+
@docker history deis/test-etcd >/dev/null 2>&1 || docker pull deis/test-etcd:latest
42+
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -v ./tests/...

controller/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ test-unit: setup-venv test-style
5959
venv/bin/python manage.py test --noinput api
6060

6161
test-functional:
62-
@docker history deis/test-etcd >/dev/null 2>&1 || docker pull deis/test-etcd
63-
@docker history deis/test-postgresql >/dev/null 2>&1 || docker pull deis/test-postgresql
64-
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -v -timeout 20m ./tests/...
62+
@docker history deis/test-etcd >/dev/null 2>&1 || docker pull deis/test-etcd:latest
63+
@docker history deis/test-postgresql >/dev/null 2>&1 || docker pull deis/test-postgresql:latest
64+
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -v ./tests/...

controller/tests/controller_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ func TestController(t *testing.T) {
3333
defer cli.CmdRm("-f", etcdName)
3434
handler := etcdutils.InitEtcd(setdir, setkeys, etcdPort)
3535
etcdutils.PublishEtcd(t, handler)
36-
cli.CmdRm("-f", "deis-test-database-"+tag)
3736
mock.RunMockDatabase(t, tag, etcdPort, utils.RandomPort())
3837
defer cli.CmdRm("-f", "deis-test-database-"+tag)
3938
host, port := utils.HostAddress(), utils.RandomPort()

database/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ test-unit:
4040
@echo no unit tests
4141

4242
test-functional:
43-
@docker history deis/test-etcd >/dev/null 2>&1 || docker pull deis/test-etcd
44-
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -v -timeout 20m ./tests/...
43+
@docker history deis/test-etcd >/dev/null 2>&1 || docker pull deis/test-etcd:latest
44+
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -v ./tests/...

logger/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ test-unit: test-style
5252
go test -v -cover ./syslog
5353

5454
test-functional:
55-
@docker history deis/test-etcd >/dev/null 2>&1 || docker pull deis/test-etcd
56-
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -v -timeout 20m ./tests/...
55+
@docker history deis/test-etcd >/dev/null 2>&1 || docker pull deis/test-etcd:latest
56+
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -v ./tests/...
5757

5858
coverage:
5959
go test -coverprofile coverage.out ./syslog

registry/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ test-unit:
4040
@echo no unit tests
4141

4242
test-functional:
43-
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -v -timeout 20m ./tests/...
43+
@docker history deis/test-etcd >/dev/null 2>&1 || docker pull deis/test-etcd:latest
44+
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -v ./tests/...

router/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ test-unit:
3838
@echo no unit tests
3939

4040
test-functional:
41-
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -v -timeout 20m ./tests/...
41+
@docker history deis/test-etcd >/dev/null 2>&1 || docker pull deis/test-etcd:latest
42+
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -v ./tests/...

router/tests/router_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,13 @@ func TestRouter(t *testing.T) {
3636
host, port := utils.HostAddress(), utils.RandomPort()
3737
fmt.Printf("--- Run deis/router:%s at %s:%s\n", tag, host, port)
3838
name := "deis-router-" + tag
39-
defer cli.CmdRm("-f", name)
4039
go func() {
4140
_ = cli.CmdRm("-f", name)
4241
err = dockercli.RunContainer(cli,
4342
"--name", name,
4443
"--rm",
4544
"-p", port+":80",
46-
"-p", "2222:2222",
45+
"-p", utils.RandomPort()+":2222",
4746
"-e", "PUBLISH="+port,
4847
"-e", "HOST="+host,
4948
"-e", "ETCD_PORT="+etcdPort,
@@ -53,7 +52,8 @@ func TestRouter(t *testing.T) {
5352
if err != nil {
5453
t.Fatal(err)
5554
}
56-
// TODO: nginx needs a few seconds to wake up here--fixme!
57-
time.Sleep(5000 * time.Millisecond)
55+
// FIXME: nginx needs a couple seconds to wake up here
56+
time.Sleep(2000 * time.Millisecond)
5857
dockercli.DeisServiceTest(t, name, port, "http")
58+
_ = cli.CmdRm("-f", name)
5959
}

0 commit comments

Comments
 (0)