@@ -3,32 +3,27 @@ package tests
33import (
44 "fmt"
55 "testing"
6- "time"
76
87 "github.com/deis/deis/tests/dockercliutils"
98 "github.com/deis/deis/tests/etcdutils"
109 "github.com/deis/deis/tests/mockserviceutils"
1110 "github.com/deis/deis/tests/utils"
1211)
1312
14- func runDeisControllerTest (t * testing.T , testSessionUID string , etcdPort string , servicePort string ) {
13+ func runDeisControllerTest (
14+ t * testing.T , testID string , etcdPort string , servicePort string ) {
1515 var err error
1616 cli , stdout , stdoutPipe := dockercliutils .GetNewClient ()
17- done := make (chan bool , 1 )
18- ipaddr := utils .GetHostIPAddress ()
19- done <- true
2017 go func () {
21- <- done
2218 err = dockercliutils .RunContainer (cli ,
23- "--name" , "deis-controller-" + testSessionUID ,
19+ "--name" , "deis-controller-" + testID ,
2420 "--rm" ,
2521 "-p" , servicePort + ":8000" ,
2622 "-e" , "PUBLISH=" + servicePort ,
27- "-e" , "HOST=" + ipaddr ,
23+ "-e" , "HOST=" + utils . GetHostIPAddress () ,
2824 "-e" , "ETCD_PORT=" + etcdPort ,
29- "deis/controller:" + testSessionUID )
25+ "deis/controller:" + testID )
3026 }()
31- time .Sleep (5000 * time .Millisecond )
3227 dockercliutils .PrintToStdout (t , stdout , stdoutPipe , "Booting" )
3328 if err != nil {
3429 t .Fatal (err )
@@ -50,22 +45,21 @@ func TestController(t *testing.T) {
5045 "/deis/registry" ,
5146 "/deis/domains" ,
5247 }
53- testSessionUID := utils .NewUuid ()
54- err := dockercliutils .BuildImage (t , "../" , "deis/controller:" + testSessionUID )
48+ testID := utils .NewUuid ()
49+ err := dockercliutils .BuildImage (t , "../" , "deis/controller:" + testID )
5550 if err != nil {
5651 t .Fatal (err )
5752 }
5853 etcdPort := utils .GetRandomPort ()
59- servicePort := utils .GetRandomPort ()
54+ dockercliutils .RunEtcdTest (t , testID , etcdPort )
55+ handler := etcdutils .InitetcdValues (setdir , setkeys , etcdPort )
56+ etcdutils .Publishvalues (t , handler )
6057 dbPort := utils .GetRandomPort ()
61- dockercliutils .RunEtcdTest (t , testSessionUID , etcdPort )
62- fmt .Println ("starting controller test:" )
63- Controllerhandler := etcdutils .InitetcdValues (setdir , setkeys , etcdPort )
64- etcdutils .Publishvalues (t , Controllerhandler )
65- mockserviceutils .RunMockDatabase (t , testSessionUID , etcdPort , dbPort )
66- fmt .Println ("starting Controller component test" )
67- runDeisControllerTest (t , testSessionUID , etcdPort , servicePort )
58+ mockserviceutils .RunMockDatabase (t , testID , etcdPort , dbPort )
59+ servicePort := utils .GetRandomPort ()
60+ fmt .Printf ("--- Test deis-controller-%s at port %s\n " , testID , servicePort )
61+ runDeisControllerTest (t , testID , etcdPort , servicePort )
6862 dockercliutils .DeisServiceTest (
69- t , "deis-controller-" + testSessionUID , servicePort , "http" )
70- dockercliutils .ClearTestSession (t , testSessionUID )
63+ t , "deis-controller-" + testID , servicePort , "http" )
64+ dockercliutils .ClearTestSession (t , testID )
7165}
0 commit comments