Merge pull request #1922 from yongtang/02232018-cleanup

Cleanup containers during the tests
This commit is contained in:
Joffrey F 2018-02-23 13:34:55 -08:00 committed by GitHub
commit 8b246db271
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -36,7 +36,7 @@ class BaseIntegrationTest(unittest.TestCase):
pass
for container in self.tmp_containers:
try:
client.api.remove_container(container, force=True)
client.api.remove_container(container, force=True, v=True)
except docker.errors.APIError:
pass
for network in self.tmp_networks:

View File

@ -47,10 +47,13 @@ class ContainerCollectionTest(BaseIntegrationTest):
self.tmp_containers.append(container.id)
container.wait()
name = "container_volume_test"
out = client.containers.run(
"alpine", "cat /insidecontainer/test",
volumes=["%s:/insidecontainer" % path]
volumes=["%s:/insidecontainer" % path],
name=name
)
self.tmp_containers.append(name)
assert out == b'hello\n'
def test_run_with_named_volume(self):
@ -66,10 +69,13 @@ class ContainerCollectionTest(BaseIntegrationTest):
self.tmp_containers.append(container.id)
container.wait()
name = "container_volume_test"
out = client.containers.run(
"alpine", "cat /insidecontainer/test",
volumes=["somevolume:/insidecontainer"]
volumes=["somevolume:/insidecontainer"],
name=name
)
self.tmp_containers.append(name)
assert out == b'hello\n'
def test_run_with_network(self):