mirror of https://github.com/docker/docker-py.git
Add hijack hints for non-detached exec api calls
Signed-off-by: David Gageot <david@gageot.net>
This commit is contained in:
parent
6dec639a1a
commit
5464cf2bea
|
@ -66,8 +66,16 @@ class ExecApiMixin(object):
|
||||||
'Detach': detach
|
'Detach': detach
|
||||||
}
|
}
|
||||||
|
|
||||||
|
headers = {} if detach else {
|
||||||
|
'Connection': 'Upgrade',
|
||||||
|
'Upgrade': 'tcp'
|
||||||
|
}
|
||||||
|
|
||||||
res = self._post_json(
|
res = self._post_json(
|
||||||
self._url('/exec/{0}/start', exec_id), data=data, stream=stream
|
self._url('/exec/{0}/start', exec_id),
|
||||||
|
headers=headers,
|
||||||
|
data=data,
|
||||||
|
stream=stream
|
||||||
)
|
)
|
||||||
|
|
||||||
if socket:
|
if socket:
|
||||||
|
|
|
@ -51,8 +51,36 @@ class ExecTest(DockerClientTest):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(args[1]['headers'],
|
self.assertEqual(
|
||||||
{'Content-Type': 'application/json'})
|
args[1]['headers'], {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Connection': 'Upgrade',
|
||||||
|
'Upgrade': 'tcp'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_exec_start_detached(self):
|
||||||
|
self.client.exec_start(fake_api.FAKE_EXEC_ID, detach=True)
|
||||||
|
|
||||||
|
args = fake_request.call_args
|
||||||
|
self.assertEqual(
|
||||||
|
args[0][1], url_prefix + 'exec/{0}/start'.format(
|
||||||
|
fake_api.FAKE_EXEC_ID
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
json.loads(args[1]['data']), {
|
||||||
|
'Tty': False,
|
||||||
|
'Detach': True
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
args[1]['headers'], {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
def test_exec_inspect(self):
|
def test_exec_inspect(self):
|
||||||
self.client.exec_inspect(fake_api.FAKE_EXEC_ID)
|
self.client.exec_inspect(fake_api.FAKE_EXEC_ID)
|
||||||
|
|
Loading…
Reference in New Issue