mirror of https://github.com/docker/compose.git
Use labels to filter containers.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
parent
77e594dc94
commit
d827809ffb
|
@ -2,6 +2,7 @@ from __future__ import unicode_literals
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from compose.service import Service
|
from compose.service import Service
|
||||||
from compose.config import make_service_dict
|
from compose.config import make_service_dict
|
||||||
|
from compose.const import LABEL_PROJECT
|
||||||
from compose.cli.docker_client import docker_client
|
from compose.cli.docker_client import docker_client
|
||||||
from compose.progress_stream import stream_output
|
from compose.progress_stream import stream_output
|
||||||
from .. import unittest
|
from .. import unittest
|
||||||
|
@ -12,12 +13,12 @@ class DockerClientTestCase(unittest.TestCase):
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.client = docker_client()
|
cls.client = docker_client()
|
||||||
|
|
||||||
# TODO: update to use labels in #652
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
for c in self.client.containers(all=True):
|
for c in self.client.containers(
|
||||||
if c['Names'] and 'composetest' in c['Names'][0]:
|
all=True,
|
||||||
self.client.kill(c['Id'])
|
filters={'label': '%s=composetest' % LABEL_PROJECT}):
|
||||||
self.client.remove_container(c['Id'])
|
self.client.kill(c['Id'])
|
||||||
|
self.client.remove_container(c['Id'])
|
||||||
for i in self.client.images():
|
for i in self.client.images():
|
||||||
if isinstance(i.get('Tag'), basestring) and 'composetest' in i['Tag']:
|
if isinstance(i.get('Tag'), basestring) and 'composetest' in i['Tag']:
|
||||||
self.client.remove_image(i)
|
self.client.remove_image(i)
|
||||||
|
|
Loading…
Reference in New Issue