Eliminate duplicates when merging port mappings from config files

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2016-05-17 15:02:29 -07:00
commit 842e372258
3 changed files with 49 additions and 1 deletions

View file

@ -834,6 +834,42 @@ class ProjectTest(DockerClientTestCase):
self.assertTrue(log_config)
self.assertEqual(log_config.get('Type'), 'none')
@v2_only()
def test_project_up_port_mappings_with_multiple_files(self):
base_file = config.ConfigFile(
'base.yml',
{
'version': V2_0,
'services': {
'simple': {
'image': 'busybox:latest',
'command': 'top',
'ports': ['1234:1234']
},
},
})
override_file = config.ConfigFile(
'override.yml',
{
'version': V2_0,
'services': {
'simple': {
'ports': ['1234:1234']
}
}
})
details = config.ConfigDetails('.', [base_file, override_file])
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), 1)
@v2_only()
def test_initialize_volumes(self):
vol_name = '{0:x}'.format(random.getrandbits(32))