-
Notifications
You must be signed in to change notification settings - Fork 998
tests: make test_networkevents portable on macOS #9140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
ad9f4e1
f0626c9
45733fc
1246a23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4814,32 +4814,55 @@ def test_networkevents(node_factory, executor): | |||||||||||||||
| 'connect_attempted': True, | ||||||||||||||||
| 'reason': f'All addresses failed: 127.0.0.1:{l1.port}: Cryptographic handshake: peer closed connection (wrong key?). '}] | ||||||||||||||||
|
|
||||||||||||||||
| # Connect failed because no listener | ||||||||||||||||
| with pytest.raises(RpcError, match="Connection establishment: Connection refused."): | ||||||||||||||||
| # Connect failed because no listener | ||||||||||||||||
| with pytest.raises( | ||||||||||||||||
| RpcError, | ||||||||||||||||
| match=r"Connection establishment: (Connection refused|Bad file descriptor)."): | ||||||||||||||||
|
aryarathoree marked this conversation as resolved.
Comment on lines
+4818
to
+4820
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a comment explaining the macOS behavior, e.g.:
Suggested change
This helps future maintainers know this is intentional and not an oversight. |
||||||||||||||||
| l1.rpc.connect(l2.info['id'], 'localhost', 1) | ||||||||||||||||
|
|
||||||||||||||||
| nevents = l1.rpc.listnetworkevents(start=5)['networkevents'] | ||||||||||||||||
| del only_one(nevents)['timestamp'] | ||||||||||||||||
| del only_one(nevents)['duration_nsec'] | ||||||||||||||||
|
|
||||||||||||||||
| assert nevents == [{'created_index': 5, | ||||||||||||||||
| 'peer_id': l2.info['id'], | ||||||||||||||||
| 'type': 'connect_fail', | ||||||||||||||||
| 'connect_attempted': True, | ||||||||||||||||
| 'reason': f'All addresses failed: 127.0.0.1:1: Connection establishment: Connection refused. '}] | ||||||||||||||||
| assert len(nevents) == 1 | ||||||||||||||||
|
|
||||||||||||||||
| event = only_one(nevents) | ||||||||||||||||
|
|
||||||||||||||||
| assert event['created_index'] == 5 | ||||||||||||||||
| assert event['peer_id'] == l2.info['id'] | ||||||||||||||||
| assert event['type'] == 'connect_fail' | ||||||||||||||||
| assert event['connect_attempted'] is True | ||||||||||||||||
|
|
||||||||||||||||
| assert re.search( | ||||||||||||||||
| r"All addresses failed: 127\.0\.0\.1:1: Connection establishment: " | ||||||||||||||||
| r"(Connection refused|Bad file descriptor)\. ", | ||||||||||||||||
| event['reason'] | ||||||||||||||||
| ) | ||||||||||||||||
|
|
||||||||||||||||
| # Connect failed because unreachable | ||||||||||||||||
| with pytest.raises(RpcError, match="Connection establishment: Connection timed out."): | ||||||||||||||||
| with pytest.raises( | ||||||||||||||||
| RpcError, | ||||||||||||||||
| match=r"Connection establishment: (Connection timed out|Bad file descriptor)."): | ||||||||||||||||
|
aryarathoree marked this conversation as resolved.
|
||||||||||||||||
| l1.rpc.connect(l2.info['id'], '1.1.1.1', 8081) | ||||||||||||||||
|
|
||||||||||||||||
| nevents = l1.rpc.listnetworkevents(start=6)['networkevents'] | ||||||||||||||||
| del only_one(nevents)['timestamp'] | ||||||||||||||||
| del only_one(nevents)['duration_nsec'] | ||||||||||||||||
|
|
||||||||||||||||
| assert nevents == [{'created_index': 6, | ||||||||||||||||
| 'peer_id': l2.info['id'], | ||||||||||||||||
| 'type': 'connect_fail', | ||||||||||||||||
| 'connect_attempted': True, | ||||||||||||||||
| 'reason': f'All addresses failed: 1.1.1.1:8081: Connection establishment: Connection timed out. '}] | ||||||||||||||||
| assert len(nevents) == 1 | ||||||||||||||||
|
|
||||||||||||||||
| event = only_one(nevents) | ||||||||||||||||
|
|
||||||||||||||||
| assert event['created_index'] == 6 | ||||||||||||||||
| assert event['peer_id'] == l2.info['id'] | ||||||||||||||||
| assert event['type'] == 'connect_fail' | ||||||||||||||||
| assert event['connect_attempted'] is True | ||||||||||||||||
|
|
||||||||||||||||
| assert re.search( | ||||||||||||||||
| r"All addresses failed: 1\.1\.1\.1:8081: Connection establishment: " | ||||||||||||||||
| r"(Connection timed out|Bad file descriptor)\. ", | ||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After applying patch: rustyrussell/ccan#128 This error becomes "Connection establishment: Operation timed out" on mac, so the test should become (Connection timed out|Operation timed out) |
||||||||||||||||
| event['reason'] | ||||||||||||||||
| ) | ||||||||||||||||
| # Connect failed because it doesn't advertize any addresses. | ||||||||||||||||
| with pytest.raises(RpcError, match="Unable to connect, no address known for peer"): | ||||||||||||||||
| l2.rpc.connect(l1.info['id']) | ||||||||||||||||
|
|
||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.