mirror of
https://github.com/docker/compose.git
synced 2025-07-06 13:24:25 +02:00
Fix stacktrace when handling timeout error
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
parent
dec2c83014
commit
5aeeecb6f2
@ -53,7 +53,7 @@ def handle_connection_errors(client):
|
|||||||
log_api_error(e, client.api_version)
|
log_api_error(e, client.api_version)
|
||||||
raise ConnectionError()
|
raise ConnectionError()
|
||||||
except (ReadTimeout, socket.timeout) as e:
|
except (ReadTimeout, socket.timeout) as e:
|
||||||
log_timeout_error()
|
log_timeout_error(client.timeout)
|
||||||
raise ConnectionError()
|
raise ConnectionError()
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,6 +42,14 @@ class DockerClientTestCase(unittest.TestCase):
|
|||||||
assert fake_log.error.call_count == 1
|
assert fake_log.error.call_count == 1
|
||||||
assert '123' in fake_log.error.call_args[0][0]
|
assert '123' in fake_log.error.call_args[0][0]
|
||||||
|
|
||||||
|
with mock.patch('compose.cli.errors.log') as fake_log:
|
||||||
|
with pytest.raises(errors.ConnectionError):
|
||||||
|
with errors.handle_connection_errors(client):
|
||||||
|
raise errors.ReadTimeout()
|
||||||
|
|
||||||
|
assert fake_log.error.call_count == 1
|
||||||
|
assert '123' in fake_log.error.call_args[0][0]
|
||||||
|
|
||||||
def test_user_agent(self):
|
def test_user_agent(self):
|
||||||
client = docker_client(os.environ)
|
client = docker_client(os.environ)
|
||||||
expected = "docker-compose/{0} docker-py/{1} {2}/{3}".format(
|
expected = "docker-compose/{0} docker-py/{1} {2}/{3}".format(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user