diff options
author | fanquake <fanquake@gmail.com> | 2023-12-11 10:43:32 +0100 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2023-12-11 10:44:39 +0100 |
commit | 09ab9d4fa731866802a6a9f9aa00d92536a8b420 (patch) | |
tree | 1c2427bc2bc07d4fc3c99ea331ceedbf22f17483 | |
parent | 41e378a0a1f0729b423034f47c28a4e83287a1e8 (diff) | |
parent | fd0bde2793239bd6d60a2435fa28df915cedd7e6 (diff) |
Merge bitcoin/bitcoin#29035: test: fix `addnode` functional test failure on OpenBSD
fd0bde2793239bd6d60a2435fa28df915cedd7e6 test: fix `addnode` functional test failure on OpenBSD (Sebastian Falbesoner)
Pull request description:
This is the functional test counterpart of PR #28891 / commit 007d6f0e85bc329040bb405ef6016339518caa66 (unfortunately, I missed it back then and only ran the unit tests -- sorry for the noise).
master branch on OpenBSD 7.4:
```
$ ./test/functional/rpc_net.py
2023-12-08T17:29:05.057000Z TestFramework (INFO): PRNG seed is: 6024296850131317403
2023-12-08T17:29:05.058000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_au3zchif
2023-12-08T17:29:05.618000Z TestFramework (INFO): Test getconnectioncount
2023-12-08T17:29:05.618000Z TestFramework (INFO): Test getpeerinfo
2023-12-08T17:29:06.643000Z TestFramework (INFO): Check getpeerinfo output before a version message was sent
2023-12-08T17:29:06.709000Z TestFramework (INFO): Test getnettotals
2023-12-08T17:29:06.773000Z TestFramework (INFO): Test getnetworkinfo
2023-12-08T17:29:06.978000Z TestFramework (INFO): Test addnode and getaddednodeinfo
2023-12-08T17:29:06.980000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
File "/home/thestack/bitcoin/test/functional/test_framework/test_framework.py", line 131, in main
self.run_test()
File "/home/thestack/bitcoin/./test/functional/rpc_net.py", line 65, in run_test
self.test_addnode_getaddednodeinfo()
File "/home/thestack/bitcoin/./test/functional/rpc_net.py", line 224, in test_addnode_getaddednodeinfo
assert_raises_rpc_error(-23, "Node already added", self.nodes[0].addnode, node=ip_port2, command='add')
File "/home/thestack/bitcoin/test/functional/test_framework/util.py", line 131, in assert_raises_rpc_error
assert try_rpc(code, message, fun, *args, **kwds), "No exception raised"
AssertionError: No exception raised
```
On the PR branch, the same call succeeds.
ACKs for top commit:
kevkevinpal:
ACK [fd0bde2](https://github.com/bitcoin/bitcoin/pull/29035/commits/fd0bde2793239bd6d60a2435fa28df915cedd7e6)
Tree-SHA512: ae20816fa4025c212e115ebd267b5e5784bfcdf0051219eb686faaade47ec4f91a3947af6d24258b159290000d2dcc3f6e65e788b83b8a9297282945dbdafbfb
-rwxr-xr-x | test/functional/rpc_net.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py index b193ffd462..83dd8bc5cd 100755 --- a/test/functional/rpc_net.py +++ b/test/functional/rpc_net.py @@ -9,6 +9,7 @@ Tests correspond to code in rpc/net.cpp. from decimal import Decimal from itertools import product +import platform import time import test_framework.messages @@ -220,8 +221,10 @@ class NetTest(BitcoinTestFramework): ip_port = "127.0.0.1:{}".format(p2p_port(2)) self.nodes[0].addnode(node=ip_port, command='add') # try to add an equivalent ip - ip_port2 = "127.1:{}".format(p2p_port(2)) - assert_raises_rpc_error(-23, "Node already added", self.nodes[0].addnode, node=ip_port2, command='add') + # (note that OpenBSD doesn't support the IPv4 shorthand notation with omitted zero-bytes) + if platform.system() != "OpenBSD": + ip_port2 = "127.1:{}".format(p2p_port(2)) + assert_raises_rpc_error(-23, "Node already added", self.nodes[0].addnode, node=ip_port2, command='add') # check that the node has indeed been added added_nodes = self.nodes[0].getaddednodeinfo() assert_equal(len(added_nodes), 1) |