Merge pull request #1489 from dnephin/faster_integration_tests
Faster integration tests
(cherry picked from commit 5231288b4e)
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
Conflicts:
compose/cli/main.py
This commit is contained in:
parent
c1b9a76a54
commit
4911c77134
15 changed files with 151 additions and 111 deletions
|
|
@ -2,6 +2,7 @@ from __future__ import unicode_literals
|
|||
from __future__ import absolute_import
|
||||
from compose.service import Service
|
||||
from compose.config import make_service_dict
|
||||
from compose.const import LABEL_PROJECT
|
||||
from compose.cli.docker_client import docker_client
|
||||
from compose.progress_stream import stream_output
|
||||
from .. import unittest
|
||||
|
|
@ -12,15 +13,15 @@ class DockerClientTestCase(unittest.TestCase):
|
|||
def setUpClass(cls):
|
||||
cls.client = docker_client()
|
||||
|
||||
# TODO: update to use labels in #652
|
||||
def setUp(self):
|
||||
for c in self.client.containers(all=True):
|
||||
if c['Names'] and 'composetest' in c['Names'][0]:
|
||||
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)
|
||||
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(
|
||||
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:
|
||||
|
|
@ -36,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