mirror of https://github.com/docker/compose.git
Fix dns and dns_search when used strings and without extends.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
6fe747e0ee
commit
fa3528ea25
|
@ -387,6 +387,10 @@ def process_service(service_config):
|
||||||
if 'extra_hosts' in service_dict:
|
if 'extra_hosts' in service_dict:
|
||||||
service_dict['extra_hosts'] = parse_extra_hosts(service_dict['extra_hosts'])
|
service_dict['extra_hosts'] = parse_extra_hosts(service_dict['extra_hosts'])
|
||||||
|
|
||||||
|
for field in ['dns', 'dns_search']:
|
||||||
|
if field in service_dict:
|
||||||
|
service_dict[field] = to_list(service_dict[field])
|
||||||
|
|
||||||
# TODO: move to a validate_service()
|
# TODO: move to a validate_service()
|
||||||
if 'ulimits' in service_dict:
|
if 'ulimits' in service_dict:
|
||||||
validate_ulimits(service_dict['ulimits'])
|
validate_ulimits(service_dict['ulimits'])
|
||||||
|
|
|
@ -535,6 +535,23 @@ class ConfigTest(unittest.TestCase):
|
||||||
}))
|
}))
|
||||||
assert "which is an invalid type" in exc.exconly()
|
assert "which is an invalid type" in exc.exconly()
|
||||||
|
|
||||||
|
def test_normalize_dns_options(self):
|
||||||
|
actual = config.load(build_config_details({
|
||||||
|
'web': {
|
||||||
|
'image': 'alpine',
|
||||||
|
'dns': '8.8.8.8',
|
||||||
|
'dns_search': 'domain.local',
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
assert actual == [
|
||||||
|
{
|
||||||
|
'name': 'web',
|
||||||
|
'image': 'alpine',
|
||||||
|
'dns': ['8.8.8.8'],
|
||||||
|
'dns_search': ['domain.local'],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class PortsTest(unittest.TestCase):
|
class PortsTest(unittest.TestCase):
|
||||||
INVALID_PORTS_TYPES = [
|
INVALID_PORTS_TYPES = [
|
||||||
|
@ -1080,8 +1097,8 @@ class EnvTest(unittest.TestCase):
|
||||||
{'foo': {'image': 'example', 'env_file': 'nonexistent.env'}},
|
{'foo': {'image': 'example', 'env_file': 'nonexistent.env'}},
|
||||||
working_dir='tests/fixtures/env'))
|
working_dir='tests/fixtures/env'))
|
||||||
|
|
||||||
assert 'Couldn\'t find env file' in exc.exconly()
|
assert 'Couldn\'t find env file' in exc.exconly()
|
||||||
assert 'nonexistent.env' in exc.exconly()
|
assert 'nonexistent.env' in exc.exconly()
|
||||||
|
|
||||||
@mock.patch.dict(os.environ)
|
@mock.patch.dict(os.environ)
|
||||||
def test_resolve_environment_from_env_file_with_empty_values(self):
|
def test_resolve_environment_from_env_file_with_empty_values(self):
|
||||||
|
|
Loading…
Reference in New Issue