|
6 | 6 | import asyncio
|
7 | 7 | import os
|
8 | 8 | import struct
|
| 9 | +import sys |
9 | 10 |
|
10 | 11 | from test_framework import messages
|
11 | 12 | from test_framework.mininode import P2PDataStore, NetworkThread
|
@@ -92,18 +93,25 @@ def run_test(self):
|
92 | 93 | #
|
93 | 94 | # Send an oversized message, ensure we're disconnected.
|
94 | 95 | #
|
95 |
| - msg_over_size = msg_unrecognized(str_data="b" * (valid_data_limit + 1)) |
96 |
| - assert len(msg_over_size.serialize()) == (msg_limit + 1) |
| 96 | + # Under macOS this test is skipped due to an unexpected error code |
| 97 | + # returned from the closing socket which python/asyncio does not |
| 98 | + # yet know how to handle. |
| 99 | + # |
| 100 | + if sys.platform != 'darwin': |
| 101 | + msg_over_size = msg_unrecognized(str_data="b" * (valid_data_limit + 1)) |
| 102 | + assert len(msg_over_size.serialize()) == (msg_limit + 1) |
97 | 103 |
|
98 |
| - with node.assert_debug_log(["Oversized message from peer=4, disconnecting"]): |
99 |
| - # An unknown message type (or *any* message type) over |
100 |
| - # MAX_PROTOCOL_MESSAGE_LENGTH should result in a disconnect. |
101 |
| - node.p2p.send_message(msg_over_size) |
102 |
| - node.p2p.wait_for_disconnect(timeout=4) |
| 104 | + with node.assert_debug_log(["Oversized message from peer=4, disconnecting"]): |
| 105 | + # An unknown message type (or *any* message type) over |
| 106 | + # MAX_PROTOCOL_MESSAGE_LENGTH should result in a disconnect. |
| 107 | + node.p2p.send_message(msg_over_size) |
| 108 | + node.p2p.wait_for_disconnect(timeout=4) |
103 | 109 |
|
104 |
| - node.disconnect_p2ps() |
105 |
| - conn = node.add_p2p_connection(P2PDataStore()) |
106 |
| - conn.wait_for_verack() |
| 110 | + node.disconnect_p2ps() |
| 111 | + conn = node.add_p2p_connection(P2PDataStore()) |
| 112 | + conn.wait_for_verack() |
| 113 | + else: |
| 114 | + self.log.info("Skipping test p2p_invalid_messages/1 (oversized message) under macOS") |
107 | 115 |
|
108 | 116 | #
|
109 | 117 | # 2.
|
|
0 commit comments