mirror of https://github.com/docker/compose.git
Update integration tests for multiple file support
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
10b3188214
commit
c0c9a7c1e4
|
@ -68,7 +68,8 @@ def get_config_path(file_option):
|
|||
log.warn('The FIG_FILE environment variable is deprecated.')
|
||||
log.warn('Please use COMPOSE_FILE instead.')
|
||||
|
||||
return [os.environ.get('COMPOSE_FILE') or os.environ.get('FIG_FILE')]
|
||||
config_file = os.environ.get('COMPOSE_FILE') or os.environ.get('FIG_FILE')
|
||||
return [config_file] if config_file else None
|
||||
|
||||
|
||||
def get_client(verbose=False):
|
||||
|
|
|
@ -9,6 +9,7 @@ from six import StringIO
|
|||
|
||||
from .. import mock
|
||||
from .testcases import DockerClientTestCase
|
||||
from compose.cli.command import get_project
|
||||
from compose.cli.errors import UserError
|
||||
from compose.cli.main import TopLevelCommand
|
||||
from compose.project import NoSuchService
|
||||
|
@ -38,7 +39,7 @@ class CLITestCase(DockerClientTestCase):
|
|||
if hasattr(self, '_project'):
|
||||
return self._project
|
||||
|
||||
return self.command.get_project()
|
||||
return get_project(self.command.base_dir)
|
||||
|
||||
def test_help(self):
|
||||
old_base_dir = self.command.base_dir
|
||||
|
@ -72,7 +73,7 @@ class CLITestCase(DockerClientTestCase):
|
|||
def test_ps_alternate_composefile(self, mock_stdout):
|
||||
config_path = os.path.abspath(
|
||||
'tests/fixtures/multiple-composefiles/compose2.yml')
|
||||
self._project = self.command.get_project(config_path)
|
||||
self._project = get_project(self.command.base_dir, [config_path])
|
||||
|
||||
self.command.base_dir = 'tests/fixtures/multiple-composefiles'
|
||||
self.command.dispatch(['-f', 'compose2.yml', 'up', '-d'], None)
|
||||
|
@ -571,7 +572,7 @@ class CLITestCase(DockerClientTestCase):
|
|||
def test_env_file_relative_to_compose_file(self):
|
||||
config_path = os.path.abspath('tests/fixtures/env-file/docker-compose.yml')
|
||||
self.command.dispatch(['-f', config_path, 'up', '-d'], None)
|
||||
self._project = self.command.get_project(config_path)
|
||||
self._project = get_project(self.command.base_dir, [config_path])
|
||||
|
||||
containers = self.project.containers(stopped=True)
|
||||
self.assertEqual(len(containers), 1)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from .testcases import DockerClientTestCase
|
||||
from compose import config
|
||||
from compose.config import config
|
||||
from compose.const import LABEL_PROJECT
|
||||
from compose.container import Container
|
||||
from compose.project import Project
|
||||
|
@ -9,7 +9,10 @@ from compose.service import ConvergenceStrategy
|
|||
|
||||
|
||||
def build_service_dicts(service_config):
|
||||
return config.load(config.ConfigDetails(service_config, 'working_dir', None))
|
||||
return config.load(
|
||||
config.ConfigDetails(
|
||||
'working_dir',
|
||||
[config.ConfigFile(None, service_config)]))
|
||||
|
||||
|
||||
class ProjectTest(DockerClientTestCase):
|
||||
|
|
|
@ -9,7 +9,7 @@ import shutil
|
|||
import tempfile
|
||||
|
||||
from .testcases import DockerClientTestCase
|
||||
from compose import config
|
||||
from compose.config import config
|
||||
from compose.const import LABEL_CONFIG_HASH
|
||||
from compose.project import Project
|
||||
from compose.service import ConvergenceStrategy
|
||||
|
@ -24,11 +24,13 @@ class ProjectTestCase(DockerClientTestCase):
|
|||
return set(project.containers(stopped=True))
|
||||
|
||||
def make_project(self, cfg):
|
||||
details = config.ConfigDetails(
|
||||
'working_dir',
|
||||
[config.ConfigFile(None, cfg)])
|
||||
return Project.from_dicts(
|
||||
name='composetest',
|
||||
client=self.client,
|
||||
service_dicts=config.load(config.ConfigDetails(cfg, 'working_dir', None))
|
||||
)
|
||||
service_dicts=config.load(details))
|
||||
|
||||
|
||||
class BasicProjectTest(ProjectTestCase):
|
||||
|
|
Loading…
Reference in New Issue