@@ -485,10 +485,14 @@ func TestContainerRunAttached(t *testing.T) {
485485 time .Sleep (1 * time .Second )
486486 c .RunDockerCmd ("rm" , "-f" , container )
487487 }
488- c .RunDockerCmd ("run" ,
489- "--name" , "fallback" , // don't reuse the container name, this container is in a weird state and blocks everything
490- "--memory" , "0.1G" , "--cpus" , "0.1" ,
491- "nginx" )
488+ go func () { // this specific call to run sometimes does not come back when in this weird state, but the container is actually running fine
489+ c .RunDockerCmd ("run" ,
490+ "--name" , container , // don't reuse the container name, this container is in a weird state and blocks everything
491+ "--memory" , "0.1G" , "--cpus" , "0.1" ,
492+ "nginx" )
493+ fmt .Printf (" [%s] Finished docker run %s\n " , t .Name (), container )
494+ }()
495+ waitForStatus (t , c , container , convert .StatusRunning )
492496 } else {
493497 res .Assert (t , icmd.Expected {Out : container })
494498 waitForStatus (t , c , container , convert .StatusRunning )
@@ -973,7 +977,10 @@ func getContainerName(stdout string) string {
973977
974978func waitForStatus (t * testing.T , c * E2eCLI , containerID string , statuses ... string ) {
975979 checkStopped := func (logt poll.LogT ) poll.Result {
976- res := c .RunDockerCmd ("inspect" , containerID )
980+ res := c .RunDockerOrExitError ("inspect" , containerID )
981+ if res .Error != nil {
982+ return poll .Continue ("Error while inspecting container %s: %s" , containerID , res .Combined ())
983+ }
977984 containerInspect , err := parseContainerInspect (res .Stdout ())
978985 assert .NilError (t , err )
979986 for _ , status := range statuses {
0 commit comments