Skip to content

Commit 0a889fa

Browse files
committed
fix(tests): randomize test port for each service
1 parent 4a3b4e4 commit 0a889fa

2 files changed

Lines changed: 17 additions & 13 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ test-unit:
5252
venv/bin/python manage.py test --noinput api
5353

5454
test-functional:
55-
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -timeout 7m -v ./tests/...
55+
GOPATH=$(CURDIR)/../tests/_vendor:$(GOPATH) go test -v ./tests/...
5656

5757
.PHONY: test

tests/controllerComponent_test.go

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,23 @@ import (
1111
"github.com/deis/deis/tests/utils"
1212
)
1313

14-
func runDeisControllerTest(t *testing.T, testSessionUID string, port string) {
14+
func runDeisControllerTest(t *testing.T, testSessionUID string, etcdPort string, servicePort string) {
1515
cli, stdout, stdoutPipe := dockercliutils.GetNewClient()
1616
done := make(chan bool, 1)
1717
dockercliutils.BuildDockerfile(t, "../", "deis/controller:"+testSessionUID)
18-
//docker run --name deis-controller -p 8000:8000 -e PUBLISH=8000 -e HOST=${COREOS_PRIVATE_IPV4} --volumes-from=deis-logger deis/controller
18+
//docker run --name deis-controller -p 8000:8000 -e PUBLISH=8000
19+
// -e HOST=${COREOS_PRIVATE_IPV4} --volumes-from=deis-logger deis/controller
1920
IPAddress := utils.GetHostIPAddress()
2021
done <- true
2122
go func() {
2223
<-done
2324
dockercliutils.RunContainer(t, cli, "--name",
24-
"deis-controller-"+testSessionUID, "-p", "8000:8000",
25-
"-e", "PUBLISH=8000", "-e", "HOST="+IPAddress,
26-
"-e", "ETCD_PORT="+port, "deis/controller:"+testSessionUID)
25+
"deis-controller-"+testSessionUID,
26+
"-p", servicePort+":8000",
27+
"-e", "PUBLISH="+servicePort,
28+
"-e", "HOST="+IPAddress,
29+
"-e", "ETCD_PORT="+etcdPort,
30+
"deis/controller:"+testSessionUID)
2731
}()
2832
time.Sleep(5000 * time.Millisecond)
2933
dockercliutils.PrintToStdout(t, stdout, stdoutPipe, "Booting")
@@ -43,16 +47,16 @@ func TestBuild(t *testing.T) {
4347
"/deis/domains"}
4448
var testSessionUID = utils.NewUuid()
4549
fmt.Println("UUID for the session Controller Test :" + testSessionUID)
46-
port := utils.GetRandomPort()
47-
//testSessionUID := "352aea64"
48-
dockercliutils.RunEtcdTest(t, testSessionUID, port)
50+
etcdPort := utils.GetRandomPort()
51+
servicePort := utils.GetRandomPort()
52+
dockercliutils.RunEtcdTest(t, testSessionUID, etcdPort)
4953
fmt.Println("starting controller test:")
50-
Controllerhandler := etcdutils.InitetcdValues(setdir, setkeys, port)
54+
Controllerhandler := etcdutils.InitetcdValues(setdir, setkeys, etcdPort)
5155
etcdutils.Publishvalues(t, Controllerhandler)
52-
mockserviceutils.RunMockDatabase(t, testSessionUID, port)
56+
mockserviceutils.RunMockDatabase(t, testSessionUID, etcdPort)
5357
fmt.Println("starting Controller component test")
54-
runDeisControllerTest(t, testSessionUID, port)
58+
runDeisControllerTest(t, testSessionUID, etcdPort, servicePort)
5559
dockercliutils.DeisServiceTest(
56-
t, "deis-controller-"+testSessionUID, "8000", "http")
60+
t, "deis-controller-"+testSessionUID, servicePort, "http")
5761
dockercliutils.ClearTestSession(t, testSessionUID)
5862
}

0 commit comments

Comments
 (0)