Skip to content

Commit

Permalink
test: add test that shows size limitation of jsoncomm
Browse files Browse the repository at this point in the history
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()`.
  • Loading branch information
mvo5 committed Aug 6, 2024
1 parent b516bdc commit c1290f3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/mod/test_util_jsoncomm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit c1290f3

Please sign in to comment.