mirror of https://github.com/docker/docker-py.git
Fix container.stats infinite blocking on stream mode (#3120)
fix: api - container.stats infinite blocking on stream mode Includes additional test for no streaming Signed-off-by: Bharath Vignesh J K <52282402+RazCrimson@users.noreply.github.com>
This commit is contained in:
parent
576e47aaac
commit
443a35360f
|
@ -1164,8 +1164,9 @@ class ContainerApiMixin:
|
|||
'one_shot is only available in conjunction with '
|
||||
'stream=False'
|
||||
)
|
||||
return self._stream_helper(self._get(url, params=params),
|
||||
decode=decode)
|
||||
return self._stream_helper(
|
||||
self._get(url, stream=True, params=params), decode=decode
|
||||
)
|
||||
else:
|
||||
if decode:
|
||||
raise errors.InvalidArgument(
|
||||
|
|
|
@ -1528,10 +1528,21 @@ class ContainerTest(BaseAPIClientTest):
|
|||
fake_request.assert_called_with(
|
||||
'GET',
|
||||
url_prefix + 'containers/' + fake_api.FAKE_CONTAINER_ID + '/stats',
|
||||
stream=True,
|
||||
timeout=60,
|
||||
params={'stream': True}
|
||||
)
|
||||
|
||||
def test_container_stats_without_streaming(self):
|
||||
self.client.stats(fake_api.FAKE_CONTAINER_ID, stream=False)
|
||||
|
||||
fake_request.assert_called_with(
|
||||
'GET',
|
||||
url_prefix + 'containers/' + fake_api.FAKE_CONTAINER_ID + '/stats',
|
||||
timeout=60,
|
||||
params={'stream': False}
|
||||
)
|
||||
|
||||
def test_container_stats_with_one_shot(self):
|
||||
self.client.stats(
|
||||
fake_api.FAKE_CONTAINER_ID, stream=False, one_shot=True)
|
||||
|
|
Loading…
Reference in New Issue