From c1290f3a0439199824d1e6fa3e3a722733a5dd3f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 6 Aug 2024 10:14:55 +0200 Subject: [PATCH] test: add test that shows size limitation of jsoncomm The jsoncomm code is using `socket.SOCK_SEQPACKET` and is written with the assumption that each send/recv transmit exactly one msg. Unfortunately there is a size limit for these messages defined by the kernel (`/proc/sys/net/core/wmem_max`) which can be hit by large messages, e.g. from a `org.osbuild.files:map()`. --- test/mod/test_util_jsoncomm.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/mod/test_util_jsoncomm.py b/test/mod/test_util_jsoncomm.py index 2d8eae261..a4a9af132 100644 --- a/test/mod/test_util_jsoncomm.py +++ b/test/mod/test_util_jsoncomm.py @@ -216,3 +216,14 @@ def test_send_and_recv(self): self.assertEqual(ping, pong) pong, _, _ = a.recv() self.assertEqual(ping, pong) + + + def test_send_and_recv_lots_of_data(self): + a, b = jsoncomm.Socket.new_pair() + + ping = {"data": "much" * 100_000} + a.send(ping) + pong, _, _ = b.send_and_recv(ping) + self.assertEqual(ping, pong) + pong, _, _ = a.recv() + self.assertEqual(ping, pong)