mirror of https://github.com/docker/docker-py.git
Total timeout should be HTTP timeout + operation timeout
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
cef9940ed3
commit
da028d88a2
|
@ -1018,10 +1018,9 @@ class ContainerApiMixin(object):
|
|||
"""
|
||||
params = {'t': timeout}
|
||||
url = self._url("/containers/{0}/restart", container)
|
||||
conn_timeout = self.timeout
|
||||
if conn_timeout:
|
||||
conn_timeout = max(conn_timeout, timeout+15)
|
||||
res = self._post(url, params=params, timeout=conn_timeout)
|
||||
res = self._post(
|
||||
url, params=params, timeout=timeout + (self.timeout or 0)
|
||||
)
|
||||
self._raise_for_status(res)
|
||||
|
||||
@utils.check_resource('container')
|
||||
|
@ -1113,8 +1112,9 @@ class ContainerApiMixin(object):
|
|||
conn_timeout = self.timeout
|
||||
if conn_timeout:
|
||||
conn_timeout = max(conn_timeout, timeout + 15)
|
||||
res = self._post(url, params=params,
|
||||
timeout=conn_timeout)
|
||||
res = self._post(
|
||||
url, params=params, timeout=timeout + (self.timeout or 0)
|
||||
)
|
||||
self._raise_for_status(res)
|
||||
|
||||
@utils.check_resource('container')
|
||||
|
|
|
@ -1165,7 +1165,7 @@ class RestartContainerTest(BaseAPIIntegrationTest):
|
|||
assert info2['State']['Running'] is True
|
||||
self.client.kill(id)
|
||||
|
||||
def test_restart_with_hight_timeout(self):
|
||||
def test_restart_with_high_timeout(self):
|
||||
container = self.client.create_container(BUSYBOX, ['sleep', '9999'])
|
||||
id = container['Id']
|
||||
self.client.start(id)
|
||||
|
|
|
@ -1264,7 +1264,7 @@ class ContainerTest(BaseAPIClientTest):
|
|||
'POST',
|
||||
url_prefix + 'containers/3cc2351ab11b/stop',
|
||||
params={'t': timeout},
|
||||
timeout=(DEFAULT_TIMEOUT_SECONDS)
|
||||
timeout=(DEFAULT_TIMEOUT_SECONDS + timeout)
|
||||
)
|
||||
|
||||
def test_stop_container_with_dict_instead_of_id(self):
|
||||
|
@ -1277,7 +1277,7 @@ class ContainerTest(BaseAPIClientTest):
|
|||
'POST',
|
||||
url_prefix + 'containers/3cc2351ab11b/stop',
|
||||
params={'t': timeout},
|
||||
timeout=(DEFAULT_TIMEOUT_SECONDS)
|
||||
timeout=(DEFAULT_TIMEOUT_SECONDS + timeout)
|
||||
)
|
||||
|
||||
def test_pause_container(self):
|
||||
|
@ -1335,7 +1335,7 @@ class ContainerTest(BaseAPIClientTest):
|
|||
'POST',
|
||||
url_prefix + 'containers/3cc2351ab11b/restart',
|
||||
params={'t': 2},
|
||||
timeout=DEFAULT_TIMEOUT_SECONDS
|
||||
timeout=(DEFAULT_TIMEOUT_SECONDS + 2)
|
||||
)
|
||||
|
||||
def test_restart_container_with_dict_instead_of_id(self):
|
||||
|
@ -1345,7 +1345,7 @@ class ContainerTest(BaseAPIClientTest):
|
|||
'POST',
|
||||
url_prefix + 'containers/3cc2351ab11b/restart',
|
||||
params={'t': 2},
|
||||
timeout=DEFAULT_TIMEOUT_SECONDS
|
||||
timeout=(DEFAULT_TIMEOUT_SECONDS + 2)
|
||||
)
|
||||
|
||||
def test_remove_container(self):
|
||||
|
|
Loading…
Reference in New Issue