Skip to content

Commit 26064dd

Browse files
authored
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 <[email protected]>
1 parent 05e1434 commit 26064dd

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ paramiko==2.11.0
33
pywin32==304; sys_platform == 'win32'
44
requests==2.28.1
55
urllib3==1.26.11
6-
websocket-client==0.56.0
6+
websocket-client==1.3.3

tests/integration/api_container_test.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ def test_run_container_streaming(self):
11971197
sock = self.client.attach_socket(container, ws=False)
11981198
assert sock.fileno() > -1
11991199

1200-
def test_run_container_reading_socket(self):
1200+
def test_run_container_reading_socket_http(self):
12011201
line = 'hi there and stuff and things, words!'
12021202
# `echo` appends CRLF, `printf` doesn't
12031203
command = f"printf '{line}'"
@@ -1217,6 +1217,25 @@ def test_run_container_reading_socket(self):
12171217
data = read_exactly(pty_stdout, next_size)
12181218
assert data.decode('utf-8') == line
12191219

1220+
@pytest.mark.xfail(condition=bool(os.environ.get('DOCKER_CERT_PATH', '')),
1221+
reason='DOCKER_CERT_PATH not respected for websockets')
1222+
def test_run_container_reading_socket_ws(self):
1223+
line = 'hi there and stuff and things, words!'
1224+
# `echo` appends CRLF, `printf` doesn't
1225+
command = f"printf '{line}'"
1226+
container = self.client.create_container(TEST_IMG, command,
1227+
detach=True, tty=False)
1228+
self.tmp_containers.append(container)
1229+
1230+
opts = {"stdout": 1, "stream": 1, "logs": 1}
1231+
pty_stdout = self.client.attach_socket(container, opts, ws=True)
1232+
self.addCleanup(pty_stdout.close)
1233+
1234+
self.client.start(container)
1235+
1236+
data = pty_stdout.recv()
1237+
assert data.decode('utf-8') == line
1238+
12201239
@pytest.mark.timeout(10)
12211240
def test_attach_no_stream(self):
12221241
container = self.client.create_container(

0 commit comments

Comments
 (0)