Skip to content

Commit a5746dc

Browse files
committed
test: avoid generating non-loopback traffic from feature_config_args.py
`feature_config_args.py` uses a proxy address of `1.2.3.4`. This results in actually trying to open TCP connections over the internet to `1.2.3.4:9050`. The test does not need those to succeed so use `127.0.0.1:1` instead. Also avoid `-noconnect=0` because that is interpreted as `-connect=1` which is interpreted as `-connect=0.0.0.1` and a connection to `0.0.0.1:18444` is attempted.
1 parent 6b3f6ea commit a5746dc

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/functional/feature_config_args.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import tempfile
1212
import time
1313

14+
from test_framework.netutil import UNREACHABLE_PROXY_ARG
1415
from test_framework.test_framework import BitcoinTestFramework
1516
from test_framework.test_node import ErrorMatch
1617
from test_framework import util
@@ -227,8 +228,8 @@ def test_invalid_command_line_options(self):
227228
)
228229

229230
def test_log_buffer(self):
230-
with self.nodes[0].assert_debug_log(expected_msgs=['Warning: parsed potentially confusing double-negative -connect=0\n']):
231-
self.start_node(0, extra_args=['-noconnect=0'])
231+
with self.nodes[0].assert_debug_log(expected_msgs=['Warning: parsed potentially confusing double-negative -listen=0\n']):
232+
self.start_node(0, extra_args=['-nolisten=0'])
232233
self.stop_node(0)
233234

234235
def test_args_log(self):
@@ -259,6 +260,7 @@ def test_args_log(self):
259260
'-rpcpassword=',
260261
'-rpcuser=secret-rpcuser',
261262
'-torpassword=secret-torpassword',
263+
UNREACHABLE_PROXY_ARG,
262264
])
263265
self.stop_node(0)
264266

@@ -307,7 +309,7 @@ def test_seed_peers(self):
307309
],
308310
timeout=10,
309311
):
310-
self.start_node(0, extra_args=['-dnsseed=1', '-fixedseeds=1', f'-mocktime={start}'])
312+
self.start_node(0, extra_args=['-dnsseed=1', '-fixedseeds=1', f'-mocktime={start}', UNREACHABLE_PROXY_ARG])
311313

312314
# Only regtest has no fixed seeds. To avoid connections to random
313315
# nodes, regtest is the only network where it is safe to enable
@@ -355,7 +357,7 @@ def test_seed_peers(self):
355357
],
356358
timeout=10,
357359
):
358-
self.start_node(0, extra_args=['-dnsseed=0', '-fixedseeds=1', '-addnode=fakenodeaddr', f'-mocktime={start}'])
360+
self.start_node(0, extra_args=['-dnsseed=0', '-fixedseeds=1', '-addnode=fakenodeaddr', f'-mocktime={start}', UNREACHABLE_PROXY_ARG])
359361
with self.nodes[0].assert_debug_log(expected_msgs=[
360362
"Adding fixed seeds as 60 seconds have passed and addrman is empty",
361363
]):
@@ -371,18 +373,18 @@ def test_connect_with_seednode(self):
371373
# When -connect is supplied, expanding addrman via getaddr calls to ADDR_FETCH(-seednode)
372374
# nodes is irrelevant and -seednode is ignored.
373375
with self.nodes[0].assert_debug_log(expected_msgs=seednode_ignored):
374-
self.start_node(0, extra_args=['-connect=fakeaddress1', '-seednode=fakeaddress2'])
376+
self.start_node(0, extra_args=['-connect=fakeaddress1', '-seednode=fakeaddress2', UNREACHABLE_PROXY_ARG])
375377

376378
# With -proxy, an ADDR_FETCH connection is made to a peer that the dns seed resolves to.
377379
# ADDR_FETCH connections are not used when -connect is used.
378380
with self.nodes[0].assert_debug_log(expected_msgs=dnsseed_ignored):
379-
self.restart_node(0, extra_args=['-connect=fakeaddress1', '-dnsseed=1', '-proxy=1.2.3.4'])
381+
self.restart_node(0, extra_args=['-connect=fakeaddress1', '-dnsseed=1', UNREACHABLE_PROXY_ARG])
380382

381383
# If the user did not disable -dnsseed, but it was soft-disabled because they provided -connect,
382384
# they shouldn't see a warning about -dnsseed being ignored.
383385
with self.nodes[0].assert_debug_log(expected_msgs=addcon_thread_started,
384386
unexpected_msgs=dnsseed_ignored):
385-
self.restart_node(0, extra_args=['-connect=fakeaddress1', '-proxy=1.2.3.4'])
387+
self.restart_node(0, extra_args=['-connect=fakeaddress1', UNREACHABLE_PROXY_ARG])
386388

387389
# We have to supply expected_msgs as it's a required argument
388390
# The expected_msg must be something we are confident will be logged after the unexpected_msg

0 commit comments

Comments
 (0)