From 5d3eda65c57de25d99d2816482ffcbcd36363d99 Mon Sep 17 00:00:00 2001 From: Milas Bowman Date: Thu, 28 Jul 2022 16:37:33 -0400 Subject: [PATCH 1/2] deps: upgrade websocket-client to latest Signed-off-by: Milas Bowman --- requirements.txt | 2 +- tests/integration/api_container_test.py | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 52b5461e2e..36660b660c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,4 @@ paramiko==2.11.0 pywin32==304; sys_platform == 'win32' requests==2.28.1 urllib3==1.26.11 -websocket-client==0.56.0 +websocket-client==1.3.3 diff --git a/tests/integration/api_container_test.py b/tests/integration/api_container_test.py index 0d6d9f96c5..bb04adee21 100644 --- a/tests/integration/api_container_test.py +++ b/tests/integration/api_container_test.py @@ -1197,7 +1197,7 @@ def test_run_container_streaming(self): sock = self.client.attach_socket(container, ws=False) assert sock.fileno() > -1 - def test_run_container_reading_socket(self): + def test_run_container_reading_socket_http(self): line = 'hi there and stuff and things, words!' # `echo` appends CRLF, `printf` doesn't command = f"printf '{line}'" @@ -1217,6 +1217,23 @@ def test_run_container_reading_socket(self): data = read_exactly(pty_stdout, next_size) assert data.decode('utf-8') == line + def test_run_container_reading_socket_ws(self): + line = 'hi there and stuff and things, words!' + # `echo` appends CRLF, `printf` doesn't + command = f"printf '{line}'" + container = self.client.create_container(TEST_IMG, command, + detach=True, tty=False) + self.tmp_containers.append(container) + + opts = {"stdout": 1, "stream": 1, "logs": 1} + pty_stdout = self.client.attach_socket(container, opts, ws=True) + self.addCleanup(pty_stdout.close) + + self.client.start(container) + + data = pty_stdout.recv() + assert data.decode('utf-8') == line + @pytest.mark.timeout(10) def test_attach_no_stream(self): container = self.client.create_container( From 779ecc5d1c303f0b7de9fba76b5135bf27d48a1c Mon Sep 17 00:00:00 2001 From: Milas Bowman Date: Thu, 28 Jul 2022 17:28:06 -0400 Subject: [PATCH 2/2] test: mark websocket test as xfail for ssl Signed-off-by: Milas Bowman --- tests/integration/api_container_test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/integration/api_container_test.py b/tests/integration/api_container_test.py index bb04adee21..8f69e41ff0 100644 --- a/tests/integration/api_container_test.py +++ b/tests/integration/api_container_test.py @@ -1217,6 +1217,8 @@ def test_run_container_reading_socket_http(self): data = read_exactly(pty_stdout, next_size) assert data.decode('utf-8') == line + @pytest.mark.xfail(condition=bool(os.environ.get('DOCKER_CERT_PATH', '')), + reason='DOCKER_CERT_PATH not respected for websockets') def test_run_container_reading_socket_ws(self): line = 'hi there and stuff and things, words!' # `echo` appends CRLF, `printf` doesn't