summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMilas Bowman <milas.bowman@docker.com>2022-07-29 11:09:47 -0400
committerGitHub <noreply@github.com>2022-07-29 11:09:47 -0400
commit26064dd6b584ee14878157b4c8b001eefed70caf (patch)
tree385403cd24e297b4ca97596a8e33b451f05c6b40 /tests
parent05e143429e892fb838bbff058391456ba3d0a19c (diff)
downloaddocker-py-26064dd6b584ee14878157b4c8b001eefed70caf.tar.gz
deps: upgrade websocket-client to latest (#3022)
* Upgrade websocket-client to latest * Add basic integration test for streaming logs via websocket Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/api_container_test.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/integration/api_container_test.py b/tests/integration/api_container_test.py
index 0d6d9f9..8f69e41 100644
--- a/tests/integration/api_container_test.py
+++ b/tests/integration/api_container_test.py
@@ -1197,7 +1197,7 @@ class AttachContainerTest(BaseAPIIntegrationTest):
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,25 @@ class AttachContainerTest(BaseAPIIntegrationTest):
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
+ 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(