Changed logging override test into integration test

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2016-01-11 16:25:19 -08:00
parent 46a474ecd9
commit ca634649bb
3 changed files with 53 additions and 28 deletions

View File

@ -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')

View File

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

View File

@ -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)