Unverified Kaydet (Commit) be9cf3e3 authored tarafından Joffrey F's avatar Joffrey F Kaydeden (comit) GitHub

Merge pull request #2327 from docker/demux_test_fixes

Streaming TTY messages sometimes get truncated
...@@ -18,7 +18,7 @@ import six ...@@ -18,7 +18,7 @@ import six
from .base import BUSYBOX, BaseAPIIntegrationTest from .base import BUSYBOX, BaseAPIIntegrationTest
from .. import helpers from .. import helpers
from ..helpers import ( from ..helpers import (
requires_api_version, ctrl_with, assert_cat_socket_detached_with_keys assert_cat_socket_detached_with_keys, ctrl_with, requires_api_version,
) )
...@@ -1163,10 +1163,10 @@ class RestartContainerTest(BaseAPIIntegrationTest): ...@@ -1163,10 +1163,10 @@ class RestartContainerTest(BaseAPIIntegrationTest):
def test_restart_with_low_timeout(self): def test_restart_with_low_timeout(self):
container = self.client.create_container(BUSYBOX, ['sleep', '9999']) container = self.client.create_container(BUSYBOX, ['sleep', '9999'])
self.client.start(container) self.client.start(container)
self.client.timeout = 1 self.client.timeout = 3
self.client.restart(container, timeout=3) self.client.restart(container, timeout=1)
self.client.timeout = None self.client.timeout = None
self.client.restart(container, timeout=3) self.client.restart(container, timeout=1)
self.client.kill(container) self.client.kill(container)
def test_restart_with_dict_instead_of_id(self): def test_restart_with_dict_instead_of_id(self):
......
...@@ -304,9 +304,13 @@ class ExecDemuxTest(BaseAPIIntegrationTest): ...@@ -304,9 +304,13 @@ class ExecDemuxTest(BaseAPIIntegrationTest):
# tty=True, stream=True, demux=False # tty=True, stream=True, demux=False
res = self.client.exec_create(self.container, self.cmd, tty=True) res = self.client.exec_create(self.container, self.cmd, tty=True)
exec_log = list(self.client.exec_start(res, stream=True)) exec_log = list(self.client.exec_start(res, stream=True))
assert len(exec_log) == 2
assert b'hello out\r\n' in exec_log assert b'hello out\r\n' in exec_log
assert b'hello err\r\n' in exec_log if len(exec_log) == 2:
assert b'hello err\r\n' in exec_log
else:
assert len(exec_log) == 3
assert b'hello err' in exec_log
assert b'\r\n' in exec_log
def test_exec_command_tty_no_stream_demux(self): def test_exec_command_tty_no_stream_demux(self):
# tty=True, stream=False, demux=True # tty=True, stream=False, demux=True
...@@ -318,6 +322,10 @@ class ExecDemuxTest(BaseAPIIntegrationTest): ...@@ -318,6 +322,10 @@ class ExecDemuxTest(BaseAPIIntegrationTest):
# tty=True, stream=True, demux=True # tty=True, stream=True, demux=True
res = self.client.exec_create(self.container, self.cmd, tty=True) res = self.client.exec_create(self.container, self.cmd, tty=True)
exec_log = list(self.client.exec_start(res, demux=True, stream=True)) exec_log = list(self.client.exec_start(res, demux=True, stream=True))
assert len(exec_log) == 2
assert (b'hello out\r\n', None) in exec_log assert (b'hello out\r\n', None) in exec_log
assert (b'hello err\r\n', None) in exec_log if len(exec_log) == 2:
assert (b'hello err\r\n', None) in exec_log
else:
assert len(exec_log) == 3
assert (b'hello err', None) in exec_log
assert (b'\r\n', None) in exec_log
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment