mirror of https://github.com/docker/compose.git
Merge pull request #4572 from shin-/Knetic-dnsopts
Implement dns_opt support in v2
This commit is contained in:
commit
2d56eb0c96
|
@ -61,6 +61,7 @@ DOCKER_CONFIG_KEYS = [
|
|||
'devices',
|
||||
'dns',
|
||||
'dns_search',
|
||||
'dns_opt',
|
||||
'domainname',
|
||||
'entrypoint',
|
||||
'env_file',
|
||||
|
|
|
@ -80,6 +80,13 @@
|
|||
"depends_on": {"$ref": "#/definitions/list_of_strings"},
|
||||
"devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
|
||||
"dns": {"$ref": "#/definitions/string_or_list"},
|
||||
"dns_opt": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"uniqueItems": true
|
||||
},
|
||||
"dns_search": {"$ref": "#/definitions/string_or_list"},
|
||||
"domainname": {"type": "string"},
|
||||
"entrypoint": {
|
||||
|
|
|
@ -100,6 +100,13 @@
|
|||
]
|
||||
},
|
||||
"devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
|
||||
"dns_opt": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"uniqueItems": true
|
||||
},
|
||||
"dns": {"$ref": "#/definitions/string_or_list"},
|
||||
"dns_search": {"$ref": "#/definitions/string_or_list"},
|
||||
"domainname": {"type": "string"},
|
||||
|
|
|
@ -54,6 +54,7 @@ DOCKER_START_KEYS = [
|
|||
'devices',
|
||||
'dns',
|
||||
'dns_search',
|
||||
'dns_opt',
|
||||
'env_file',
|
||||
'extra_hosts',
|
||||
'group_add',
|
||||
|
@ -755,6 +756,7 @@ class Service(object):
|
|||
network_mode=self.network_mode.mode,
|
||||
devices=options.get('devices'),
|
||||
dns=options.get('dns'),
|
||||
dns_opt=options.get('dns_opt'),
|
||||
dns_search=options.get('dns_search'),
|
||||
restart_policy=options.get('restart'),
|
||||
cap_add=options.get('cap_add'),
|
||||
|
|
|
@ -887,8 +887,16 @@ class ServiceTest(DockerClientTestCase):
|
|||
container = create_and_start_container(service)
|
||||
|
||||
host_container_groupadd = container.get('HostConfig.GroupAdd')
|
||||
self.assertTrue("root" in host_container_groupadd)
|
||||
self.assertTrue("1" in host_container_groupadd)
|
||||
assert "root" in host_container_groupadd
|
||||
assert "1" in host_container_groupadd
|
||||
|
||||
def test_dns_opt_value(self):
|
||||
service = self.create_service('web', dns_opt=["use-vc", "no-tld-query"])
|
||||
container = create_and_start_container(service)
|
||||
|
||||
dns_opt = container.get('HostConfig.DnsOptions')
|
||||
assert 'use-vc' in dns_opt
|
||||
assert 'no-tld-query' in dns_opt
|
||||
|
||||
def test_restart_on_failure_value(self):
|
||||
service = self.create_service('web', restart={
|
||||
|
|
|
@ -1411,7 +1411,6 @@ class ConfigTest(unittest.TestCase):
|
|||
]
|
||||
|
||||
def test_group_add_option(self):
|
||||
|
||||
actual = config.load(build_config_details({
|
||||
'version': '2',
|
||||
'services': {
|
||||
|
@ -1430,6 +1429,25 @@ class ConfigTest(unittest.TestCase):
|
|||
}
|
||||
]
|
||||
|
||||
def test_dns_opt_option(self):
|
||||
actual = config.load(build_config_details({
|
||||
'version': '2',
|
||||
'services': {
|
||||
'web': {
|
||||
'image': 'alpine',
|
||||
'dns_opt': ["use-vc", "no-tld-query"]
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
||||
assert actual.services == [
|
||||
{
|
||||
'name': 'web',
|
||||
'image': 'alpine',
|
||||
'dns_opt': ["use-vc", "no-tld-query"]
|
||||
}
|
||||
]
|
||||
|
||||
def test_isolation_option(self):
|
||||
actual = config.load(build_config_details({
|
||||
'version': V2_1,
|
||||
|
|
Loading…
Reference in New Issue