@@ -485,10 +485,14 @@ func TestContainerRunAttached(t *testing.T) {
485
485
time .Sleep (1 * time .Second )
486
486
c .RunDockerCmd ("rm" , "-f" , container )
487
487
}
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 )
492
496
} else {
493
497
res .Assert (t , icmd.Expected {Out : container })
494
498
waitForStatus (t , c , container , convert .StatusRunning )
@@ -973,7 +977,10 @@ func getContainerName(stdout string) string {
973
977
974
978
func waitForStatus (t * testing.T , c * E2eCLI , containerID string , statuses ... string ) {
975
979
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
+ }
977
984
containerInspect , err := parseContainerInspect (res .Stdout ())
978
985
assert .NilError (t , err )
979
986
for _ , status := range statuses {
0 commit comments