File tree Expand file tree Collapse file tree
utils/docker_fixtures/_test_clients Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -169,11 +169,19 @@ def _wait(self, timeout: float):
169169 try :
170170 if self ._is_alive ():
171171 break
172- except Exception :
173- if self .container .status != "running" :
174- self ._print_logs ()
175- message = f"Container { self .container .name } status is { self .container .status } . Please check logs."
176- _fail (message )
172+ except Exception as e :
173+ logger .debug (f"Error while checking if { self .container .name } is alive: { e } " )
174+
175+ # _is_alive() swallows a non-running container status and returns False instead of
176+ # raising, so the check must be repeated here on every iteration (not only in the
177+ # except branch above) or a container that exits early (e.g. crash, port collision)
178+ # silently gets retried for the full timeout instead of failing fast with its logs.
179+ self .container .reload ()
180+ if self .container .status not in ("running" , "created" ):
181+ self ._print_logs ()
182+ message = f"Container { self .container .name } status is { self .container .status } . Please check logs."
183+ _fail (message )
184+
177185 time .sleep (delay )
178186 else :
179187 self ._print_logs ()
You can’t perform that action at this time.
0 commit comments