Merge "Clean up network resources after tempest tests"
This commit is contained in:
commit
d0bd3a418f
@ -224,3 +224,11 @@ class DockerClient(object):
|
||||
def delete_image(self, name):
|
||||
with docker_utils.docker_client() as docker:
|
||||
return docker.remove_image(name)
|
||||
|
||||
def list_networks(self, name):
|
||||
with docker_utils.docker_client() as docker:
|
||||
return docker.networks(names=[name])
|
||||
|
||||
def remove_network(self, name):
|
||||
with docker_utils.docker_client() as docker:
|
||||
return docker.remove_network(name)
|
||||
|
@ -47,6 +47,12 @@ class TestContainer(base.BaseZunTest):
|
||||
self.container_client.delete_container(c['uuid'],
|
||||
params={'force': True})
|
||||
|
||||
# cleanup the network resources
|
||||
project_id = self.container_client.tenant_id
|
||||
networks = self.docker_client.list_networks(project_id)
|
||||
for network in networks:
|
||||
self.docker_client.remove_network(network['Id'])
|
||||
|
||||
super(TestContainer, self).tearDown()
|
||||
|
||||
@decorators.idempotent_id('b8946b8c-57d5-4fdc-a09a-001d6b552725')
|
||||
|
Loading…
Reference in New Issue
Block a user