@@ -4,50 +4,27 @@ import (
44 "fmt"
55 "github.com/deis/deis/tests/dockercliutils"
66 "github.com/deis/deis/tests/etcdutils"
7- "github.com/deis/deis/tests/mockserviceutils"
87 "github.com/deis/deis/tests/utils"
9- "net/http"
10- "strings"
118 "testing"
129 "time"
1310)
1411
15- func runDeisBuilderTest (t * testing.T , testSessionUid string ) {
12+ func runDeisBuilderTest (t * testing.T , testSessionUid string , port string ) {
1613 cli , stdout , stdoutPipe := dockercliutils .GetNewClient ()
1714 done := make (chan bool , 1 )
1815 dockercliutils .BuildDockerfile (t , "../" , "deis/builder:" + testSessionUid )
1916 dockercliutils .RunDeisDataTest (t , "--name" , "deis-builder-data" , "-v" , "/var/lib/docker" , "deis/base" , "/bin/true" )
2017 //docker run --name deis-builder -p 2223:22 -e PUBLISH=22 -e HOST=${COREOS_PRIVATE_IPV4} -e PORT=2223 --volumes-from deis-builder-data --privileged deis/builder
21- IPAddress := func () string {
22- var Ip string
23- if utils .GetHostOs () == "darwin" {
24- Ip = "172.17.8.100"
25- }
26- return Ip
27- }()
18+ IPAddress := utils .GetHostIpAddress ()
2819 done <- true
2920 go func () {
3021 <- done
31- fmt .Println ("inside run container" )
32- dockercliutils .RunContainer (t , cli , "--name" , "deis-builder-" + testSessionUid , "-p" , "2223:22" , "-e" , "PUBLISH=22" , "-e" , "STORAGE_DRIVER=aufs" , "-e" , "HOST=" + IPAddress , "-e" , "PORT=2223" ,"--volumes-from" ,"deis-builder-data" ,"--privileged" , "deis/builder:" + testSessionUid )
22+ dockercliutils .RunContainer (t , cli , "--name" , "deis-builder-" + testSessionUid , "-p" , "2223:22" , "-e" , "PUBLISH=22" , "-e" , "STORAGE_DRIVER=aufs" , "-e" , "HOST=" + IPAddress , "-e" ,"ETCD_PORT=" + port , "-e" , "PORT=2223" ,"--volumes-from" ,"deis-builder-data" ,"--privileged" , "deis/builder:" + testSessionUid )
3323 }()
3424 time .Sleep (5000 * time .Millisecond )
3525 dockercliutils .PrintToStdout (t , stdout , stdoutPipe , "deis-builder running" )
3626}
3727
38- func deisBuilderServiceTest (t * testing.T , testSessionUid string ) {
39- IPAddress := dockercliutils .GetInspectData (t , "{{ .NetworkSettings.IPAddress }}" , "deis-controller-" + testSessionUid )
40- if strings .Contains (IPAddress , "Error" ) {
41- t .Fatalf ("worng IP %s" , IPAddress )
42- }
43- url := "http://" + IPAddress + ":8000"
44- response , err := http .Get (url )
45- if err != nil {
46- t .Fatalf ("Not reachable %s" , err )
47- }
48- fmt .Println (response )
49- }
50-
5128func TestBuild (t * testing.T ) {
5229 setkeys := []string {"/deis/registry/protocol" ,
5330 "deis/registry/host" ,
@@ -61,14 +38,14 @@ func TestBuild(t *testing.T) {
6138 "/deis/domains" }
6239 fmt .Println ("1st" )
6340 var testSessionUid = utils .GetnewUuid ()
41+ fmt .Println ("UUID for the session Builder Test :" + testSessionUid )
42+ port := utils .GetRandomPort ()
6443 //testSessionUid := "352aea64"
65- dockercliutils .RunDummyEtcdTest (t , testSessionUid )
66- fmt .Println ("2nd" )
67- t .Logf ("starting controller test: %v" , testSessionUid )
68- Builderhandler := etcdutils .InitetcdValues (setdir , setkeys )
44+ dockercliutils .RunEtcdTest (t , testSessionUid ,port )
45+ Builderhandler := etcdutils .InitetcdValues (setdir , setkeys ,port )
6946 etcdutils .Publishvalues (t , Builderhandler )
70- fmt .Println ("starting registry test" )
71- runDeisBuilderTest (t , testSessionUid )
72- //deisBuilderServiceTest (t, testSessionUid)
73- // dockercliutils.ClearTestSession(t, testSessionUid)
47+ fmt .Println ("starting Builder Component test" )
48+ runDeisBuilderTest (t , testSessionUid , port )
49+ dockercliutils . DeisServiceTest (t ,"deis-builder-" + testSessionUid , "22" , "tcp" )
50+ dockercliutils .ClearTestSession (t , testSessionUid )
7451}
0 commit comments