Clean up created volume from test_run_with_named_volume

This fix adds the volume id to the list so that it could be
cleaned up on test teardown.

The issue was originally from https://github.com/moby/moby/pull/36292
where an additional `somevolume` pre-exists in tests.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang 2018-02-14 13:01:16 +00:00
parent 14eec99bed
commit cbbc37ac7b
1 changed files with 2 additions and 1 deletions

View File

@ -55,7 +55,8 @@ class ContainerCollectionTest(BaseIntegrationTest):
def test_run_with_named_volume(self):
client = docker.from_env(version=TEST_API_VERSION)
client.volumes.create(name="somevolume")
volume = client.volumes.create(name="somevolume")
self.tmp_volumes.append(volume.id)
container = client.containers.run(
"alpine", "sh -c 'echo \"hello\" > /insidecontainer/test'",