mirror of https://github.com/docker/docker-py.git
Re-enable pid_mode checks for API < 1.24
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
7ef48c3769
commit
44e57fb95d
|
|
@ -736,6 +736,8 @@ def create_host_config(binds=None, port_bindings=None, lxc_conf=None,
|
|||
host_config['ShmSize'] = shm_size
|
||||
|
||||
if pid_mode:
|
||||
if version_lt(version, '1.24') and pid_mode != 'host':
|
||||
raise host_config_value_error('pid_mode', pid_mode)
|
||||
host_config['PidMode'] = pid_mode
|
||||
|
||||
if ipc_mode:
|
||||
|
|
|
|||
|
|
@ -361,10 +361,6 @@ class CreateContainerTest(BaseAPIIntegrationTest):
|
|||
host_config = inspect['HostConfig']
|
||||
self.assertIn('MemorySwappiness', host_config)
|
||||
|
||||
def test_create_host_config_exception_raising(self):
|
||||
self.assertRaises(TypeError,
|
||||
self.client.create_host_config, mem_swappiness='40')
|
||||
|
||||
def test_create_with_environment_variable_no_value(self):
|
||||
container = self.client.create_container(
|
||||
BUSYBOX,
|
||||
|
|
|
|||
|
|
@ -205,6 +205,19 @@ class HostConfigTest(unittest.TestCase):
|
|||
version='1.24', isolation={'isolation': 'hyperv'}
|
||||
)
|
||||
|
||||
def test_create_host_config_pid_mode(self):
|
||||
with pytest.raises(ValueError):
|
||||
create_host_config(version='1.23', pid_mode='baccab125')
|
||||
|
||||
config = create_host_config(version='1.23', pid_mode='host')
|
||||
assert config.get('PidMode') == 'host'
|
||||
config = create_host_config(version='1.24', pid_mode='baccab125')
|
||||
assert config.get('PidMode') == 'baccab125'
|
||||
|
||||
def test_create_host_config_invalid_mem_swappiness(self):
|
||||
with pytest.raises(TypeError):
|
||||
create_host_config(version='1.24', mem_swappiness='40')
|
||||
|
||||
|
||||
class UlimitTest(unittest.TestCase):
|
||||
def test_create_host_config_dict_ulimit(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue