Speed up integration test and make cleanup easier by using labels
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
parent
d827809ffb
commit
60351a8e07
10 changed files with 47 additions and 53 deletions
|
|
@ -13,15 +13,15 @@ class DockerClientTestCase(unittest.TestCase):
|
|||
def setUpClass(cls):
|
||||
cls.client = docker_client()
|
||||
|
||||
def setUp(self):
|
||||
def tearDown(self):
|
||||
for c in self.client.containers(
|
||||
all=True,
|
||||
filters={'label': '%s=composetest' % LABEL_PROJECT}):
|
||||
self.client.kill(c['Id'])
|
||||
self.client.remove_container(c['Id'])
|
||||
for i in self.client.images():
|
||||
if isinstance(i.get('Tag'), basestring) and 'composetest' in i['Tag']:
|
||||
self.client.remove_image(i)
|
||||
for i in self.client.images(
|
||||
filters={'label': 'com.docker.compose.test_image'}):
|
||||
self.client.remove_image(i)
|
||||
|
||||
def create_service(self, name, **kwargs):
|
||||
if 'image' not in kwargs and 'build' not in kwargs:
|
||||
|
|
@ -37,5 +37,6 @@ class DockerClientTestCase(unittest.TestCase):
|
|||
)
|
||||
|
||||
def check_build(self, *args, **kwargs):
|
||||
kwargs.setdefault('rm', True)
|
||||
build_output = self.client.build(*args, **kwargs)
|
||||
stream_output(build_output, open('/dev/null', 'w'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue