This PR fixes the issue mentioned here, to avoid port collisions between nodes spun up by the test framework.
test: Fix port collisions caused by p2p_getaddr_caching.py #25312
pull dergoegge wants to merge 2 commits into bitcoin:master from dergoegge:2022-06-addr-cache-test-fix changing 2 files +6 −8-
dergoegge commented at 4:41 PM on June 8, 2022: member
- fanquake added the label Tests on Jun 8, 2022
-
in test/functional/p2p_getaddr_caching.py:47 in 7670a11f37 outdated
42 | @@ -44,13 +43,15 @@ def addr_received(self): 43 | class AddrTest(BitcoinTestFramework): 44 | def set_test_params(self): 45 | self.num_nodes = 1 46 | - # Start onion ports after p2p and rpc ports. 47 | - port = PORT_MIN + 2 * PORT_RANGE 48 | - self.onion_port1 = port 49 | - self.onion_port2 = port + 1 50 | + 51 | + def setup_network(self):
MarcoFalke commented at 5:31 PM on June 8, 2022:any need to overwrite this method?
PortSeed.nshould be possible to set right after parsing the options:diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index a39ee003ef..3f02d21d42 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -223,11 +223,11 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): # It still needs to exist and be None in order for tests to work however. self.options.descriptors = None + PortSeed.n = self.options.port_seed + def setup(self): """Call this method to start up the test framework object with options set.""" - PortSeed.n = self.options.port_seed - check_json_precision() self.options.cachedir = os.path.abspath(self.options.cachedir)MarcoFalke commented at 6:02 PM on June 8, 2022: memberThe other tests could be fixed as well (in a follow-up)
f9682e75ac[test_framework] Set PortSeed.n directly after initialising params
This allows us to use `p2p_port()` with `set_test_params()`.
[test] Fix port collisions caused by p2p_getaddr_caching.py ea54ba2f42dergoegge force-pushed on Jun 8, 2022MarcoFalke merged this on Jun 10, 2022MarcoFalke closed this on Jun 10, 2022MarcoFalke referenced this in commit b71d37da2c on Jun 10, 2022sidhujag referenced this in commit 7baafa5dc4 on Jun 13, 2022Fabcien referenced this in commit 1efb53c8e3 on Apr 27, 2023DrahtBot locked this on Jun 10, 2023
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 09:13 UTC
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 09:13 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me