Bläddra i källkod

Changed logging override test into integration test

Signed-off-by: Joffrey F <[email protected]>
Joffrey F 9 år sedan
förälder
incheckning
ca634649bb

+ 0 - 23
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')

+ 0 - 5
tests/fixtures/logging-composefile/compose2.yml

@@ -1,5 +0,0 @@
-version: 2
-services:
-  another:
-    logging:
-      driver: "none"

+ 53 - 0
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)