MCPcopy Create free account
hub / github.com/ElementsProject/lightning / assert_constant_payload

Method assert_constant_payload

tests/fixtures.py:153–172  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

151 self.proc = None
152
153 def assert_constant_payload(self):
154 tshark_cmd = [
155 "tshark",
156 "-r", str(self.pcap),
157 "-Y", "tcp.len > 0",
158 "-T", "fields",
159 "-e", "tcp.len",
160 ]
161
162 out = subprocess.check_output(tshark_cmd, text=True)
163 lengths = [int(x) for x in out.splitlines() if x.strip()]
164
165 assert lengths, f"No TCP payload packets captured on port {self.port}"
166
167 uniq = set(lengths)
168 assert len(uniq) == 1, (
169 f"Non-constant TCP payload sizes on port {self.port}: "
170 f"{sorted(uniq)}:"
171 + subprocess.check_output(["tshark", "-r", str(self.pcap)], text=True)
172 )
173
174
175@pytest.fixture

Callers 1

tcp_captureFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected