Skip to content

Commit 7f1a9a3

Browse files
test: verify all node fields in ServersResponse round-trip test
The test only checked 3 of 9 node fields (node 0's id/address and node 1's role). A decoder bug affecting inter-node boundary handling after the first node's address padding would go undetected. Now verifies all fields for all nodes using a loop. Closes #171. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1c61208 commit 7f1a9a3

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

tests/test_messages_responses.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,9 +1046,10 @@ def test_roundtrip(self) -> None:
10461046
encoded = msg.encode()
10471047
decoded = ServersResponse.decode_body(encoded[HEADER_SIZE:])
10481048
assert len(decoded.nodes) == 3
1049-
assert decoded.nodes[0].node_id == 1
1050-
assert decoded.nodes[0].address == "node1:9001"
1051-
assert decoded.nodes[1].role == 2
1049+
for i, expected in enumerate(nodes):
1050+
assert decoded.nodes[i].node_id == expected.node_id
1051+
assert decoded.nodes[i].address == expected.address
1052+
assert decoded.nodes[i].role == expected.role
10521053

10531054
def test_wire_format_starts_with_count(self) -> None:
10541055
"""Body must start with uint64 node count per Go reference."""

0 commit comments

Comments
 (0)