Skip to content

Commit

Permalink
test-image.py: fix previous commit, we failed to clean-up in the all-…
Browse files Browse the repository at this point in the history
…good path
  • Loading branch information
strohel committed Mar 23, 2020
1 parent 29806fa commit 8c7c944
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test-image.py
Expand Up @@ -148,11 +148,15 @@ def run_container(dockerc: docker.DockerClient, run_opts):
cpuset_cpus = "0-3" # Assign 4 logical CPUs to the container to simulate our real cluster.

container = dockerc.containers.run(cpuset_cpus=cpuset_cpus, nano_cpus=nano_cpus, **run_opts)
stopped = False
try:
yield container
except ContainerDied as e:
log_check('Stops gracefully', f'Very Bad, probably died after {e.connections} connections')
except BaseException:
stopped = True
finally:
if stopped:
return
timeout = 15
start = perf_counter()
container.stop(timeout=timeout)
Expand Down

0 comments on commit 8c7c944

Please sign in to comment.