From ca634649bbdb92cd7c52a98ee693d0c55a1e153b Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Mon, 11 Jan 2016 16:25:19 -0800 Subject: [PATCH] Changed logging override test into integration test Signed-off-by: Joffrey F --- tests/acceptance/cli_test.py | 23 -------- .../fixtures/logging-composefile/compose2.yml | 5 -- tests/integration/project_test.py | 53 +++++++++++++++++++ 3 files changed, 53 insertions(+), 28 deletions(-) delete mode 100644 tests/fixtures/logging-composefile/compose2.yml diff --git a/tests/acceptance/cli_test.py b/tests/acceptance/cli_test.py index 8abdf7854..caadb62fc 100644 --- a/tests/acceptance/cli_test.py +++ b/tests/acceptance/cli_test.py @@ -744,29 +744,6 @@ class CLITestCase(DockerClientTestCase): self.assertEqual(log_config.get('Type'), 'json-file') self.assertEqual(log_config.get('Config')['max-size'], '10m') - def test_up_logging_with_multiple_files(self): - self.base_dir = 'tests/fixtures/logging-composefile' - config_paths = [ - 'docker-compose.yml', - 'compose2.yml', - ] - self._project = get_project(self.base_dir, config_paths) - self.dispatch( - [ - '-f', config_paths[0], - '-f', config_paths[1], - 'up', '-d', - ], - None) - - containers = self.project.containers() - self.assertEqual(len(containers), 2) - - another = self.project.get_service('another').containers()[0] - log_config = another.get('HostConfig.LogConfig') - self.assertTrue(log_config) - self.assertEqual(log_config.get('Type'), 'none') - def test_pause_unpause(self): self.dispatch(['up', '-d'], None) service = self.project.get_service('simple') diff --git a/tests/fixtures/logging-composefile/compose2.yml b/tests/fixtures/logging-composefile/compose2.yml deleted file mode 100644 index 69889761b..000000000 --- a/tests/fixtures/logging-composefile/compose2.yml +++ /dev/null @@ -1,5 +0,0 @@ -version: 2 -services: - another: - logging: - driver: "none" diff --git a/tests/integration/project_test.py b/tests/integration/project_test.py index 2cf5f5565..5a1444b67 100644 --- a/tests/integration/project_test.py +++ b/tests/integration/project_test.py @@ -3,6 +3,8 @@ from __future__ import unicode_literals import random +import py + from .testcases import DockerClientTestCase from compose.cli.docker_client import docker_client from compose.config import config @@ -534,6 +536,57 @@ class ProjectTest(DockerClientTestCase): self.assertEqual(volume_data['Name'], full_vol_name) self.assertEqual(volume_data['Driver'], 'local') + def test_project_up_logging_with_multiple_files(self): + base_file = config.ConfigFile( + 'base.yml', + { + 'version': 2, + 'services': { + 'simple': {'image': 'busybox:latest', 'command': 'top'}, + 'another': { + 'image': 'busybox:latest', + 'command': 'top', + 'logging': { + 'driver': "json-file", + 'options': { + 'max-size': "10m" + } + } + } + } + + }) + override_file = config.ConfigFile( + 'override.yml', + { + 'version': 2, + 'services': { + 'another': { + 'logging': { + 'driver': "none" + } + } + } + + }) + details = config.ConfigDetails('.', [base_file, override_file]) + + tmpdir = py.test.ensuretemp('logging_test') + self.addCleanup(tmpdir.remove) + with tmpdir.as_cwd(): + config_data = config.load(details) + project = Project.from_config( + name='composetest', config_data=config_data, client=self.client + ) + project.up() + containers = project.containers() + self.assertEqual(len(containers), 2) + + another = project.get_service('another').containers()[0] + log_config = another.get('HostConfig.LogConfig') + self.assertTrue(log_config) + self.assertEqual(log_config.get('Type'), 'none') + def test_initialize_volumes(self): vol_name = '{0:x}'.format(random.getrandbits(32)) full_vol_name = 'composetest_{0}'.format(vol_name)