@@ -175,9 +175,16 @@ func RunContainer(t *testing.T, cli *client.DockerCli, args ...string) {
175175 fmt .Println ("Running docker container :" + args [1 ])
176176 err := cli .CmdRun (args ... )
177177 if err != nil {
178- if ! ((strings .Contains (
179- fmt .Sprintf ("%s" , err ), "read/write on closed pipe" )) || (strings .Contains (fmt .Sprintf ("%s" , err ), "Code: -1" )) || (strings .Contains (fmt .Sprintf ("%s" , err ), "Code: 2" ))) {
180- t .Fatalf ("Run Docker container failed %s" , err )
178+ // Ignore certain errors we see in io handling.
179+ switch msg := err .Error (); {
180+ case strings .Contains (msg , "read/write on closed pipe" ):
181+ return
182+ case strings .Contains (msg , "Code: -1" ):
183+ return
184+ case strings .Contains (msg , "Code: 2" ):
185+ return
186+ default :
187+ t .Fatalf ("RunContainer failed: %v" , err )
181188 }
182189 }
183190}
@@ -334,22 +341,22 @@ func GetImageID(t *testing.T, repo string) string {
334341
335342// RunEtcdTest starts an etcd docker container for testing.
336343func RunEtcdTest (t * testing.T , uid string , port string ) {
337- //docker run -t -i --name=deis-etcd -p 4001:4001 -e HOST_IP=172.17.8.100 -e ETCD_ADDR=172.17.8.100:4001 --entrypoint=/bin/bash phife.atribecalledchris.com:5000/deis/etcd:0.3.0 -c /usr/local/bin/etcd
344+ //docker run -t -i --name=deis-etcd -p 4001:4001 -e HOST_IP=172.17.8.100
345+ // -e ETCD_ADDR=172.17.8.100:4001
346+ // --entrypoint=/bin/bash phife.atribecalledchris.com:5000/deis/etcd:0.3.0
347+ // -c /usr/local/bin/etcd
338348 cli , stdout , stdoutPipe := GetNewClient ()
339349 done2 := make (chan bool , 1 )
340- var imageID string
341- var imageTag string
342350 IPAddress := utils .GetHostIPAddress ()
343351 go func () {
344- PullImage (t , cli , "deisreleases/etcd:test" )
345- imageID = GetImageID (t , "deisreleases/etcd" )
346- imageTag = "deis/etcd:" + uid
347- cli .CmdTag (imageID , imageTag )
352+ PullImage (t , cli , "deis/test-etcd:latest" )
348353 done2 <- true
349- RunContainer (t , cli , "--name" , "deis-etcd-" + uid ,
350- "-p" , port + ":" + port , "-e" , "HOST_IP=" + IPAddress ,
351- "-e" , "ETCD_ADDR=" + IPAddress + ":" + port , "--entrypoint=/bin/bash" ,
352- imageTag , "-c" , "/usr/local/bin/etcd" )
354+ RunContainer (t , cli ,
355+ "--name" , "deis-etcd-" + uid ,
356+ "-p" , port + ":" + port ,
357+ "-e" , "HOST_IP=" + IPAddress ,
358+ "-e" , "ETCD_ADDR=" + IPAddress + ":" + port ,
359+ "deis/test-etcd:latest" )
353360 }()
354361 go func () {
355362 <- done2
0 commit comments