Skip to content

Conversation

@vasild
Copy link
Contributor

@vasild vasild commented Sep 11, 2025

This PR includes #32757 (first two commits here).

Then, on top of that:

feature_bind_port_discover.py and feature_bind_port_externalip.py require a routable address on the machine to run. Since that was not predictably available on CI, those tests required a manual setting up of IP addresses (e.g. using ifconfig) and then running the tests with a command line option telling them that the addresses are set up. The tests were not run in CI and got rot.

Change that to auto-detect, from the tests, whether the needed IP addresses are present and if yes, run the test, otherwise skip it. Also change the CI to configure the needed addresses when running the functional tests. This way the tests will be run regularly on CI.

Fixes: #31293
Fixes: #31336

@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 11, 2025

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33362.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #33732 (ci: Call docker exec from Python script to fix word splitting by maflcko)
  • #32757 (net: Fix Discover() not running when using -bind=0.0.0.0:port by b-l-u-e)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

LLM Linter (✨ experimental)

Possible typos and grammar issues:

  • interface on this machine' -> a non-loopback interface on this machine' [adds the missing article "a" to make the sentence grammatical and clear]

drahtbot_id_5_m

@vasild
Copy link
Contributor Author

vasild commented Sep 11, 2025

69177404ba...f047fce8ab: fix typo

@vasild
Copy link
Contributor Author

vasild commented Sep 12, 2025

f047fce8ab...9b30b0bea8: set up the needed addresses of the VMs outside of the VMs, when setting them up using docker run and docker network connect, instead of from inside the VM. The former seems to be simpler. Idea from the discussion above.

b-l-u-e and others added 4 commits November 6, 2025 17:41
…dd comprehensive test coverage

test: use tor_port to prevent bind conflicts

test: Update feature_bind_port_discover.py instructions
Replace deprecated ifconfig with modern ip commands and updated
instructions for non-loopback interfaces.
… skip condition

Instead of requiring a run with an explicit `--ihave1111and2222`, detect
whether the routable addresses are set up and if not, then skip the test.

To detect whether the addresses are set use `bitcoind` - start it
and ask it to bind on them and see if it will error with
"Unable to bind". Since this is what the tests do anyway, just start
the nodes and see if an exception will be raised like
`FailedToStartError` / "Unable to bind".

This makes it possible for the CI to run
`feature_bind_port_discover.py` and
`feature_bind_port_externalip.py` by just setting up the
addresses, without having to explicitly provide `--ihave1111and2222`.
Also explicitly specify which addresses from the docker network to
assign to the VM.

With `1.1.1.5` and `1111:1111::5` set on the machine, the tests
`feature_bind_port_discover.py` and
`feature_bind_port_externalip.py` will run.
@vasild
Copy link
Contributor Author

vasild commented Nov 6, 2025

9b30b0bea8...e245da32dc: rebase due to conflicts

@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

).stdout.strip()
os.environ["CI_CONTAINER_ID"] = container_id

run(["docker", "network", "connect", "--ip=1.1.1.5", "ci-ip4net", container_id])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The container has been attached to both the default bridge network and ci-ip4net, hence two
IPv4 addresses. Do you think getifaddrs() may return the bridge IP first, and cause Discover() to find the wrong address?

If thats the case then I think it might be worth it to disconnect from bridge after connecting to ci-ip4net.

CI_CCACHE_MOUNT = f"type=bind,src={os.environ['CCACHE_DIR']},dst={os.environ['CCACHE_DIR']}"

run(["docker", "network", "create", "--ipv6", "--subnet", "1111:1111::/112", "ci-ip6net"], check=False)
run(["docker", "network", "create", "--subnet", "1.1.1.0/24", "ci-ip4net"], check=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to use RFC-5737 here? (I think they are reserved for documentation and testing)

try:
self.start_nodes()
except FailedToStartError as e:
for node in self.nodes:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error/cleanup code is duplicated in both files (with the exception of printing 1 or 2 addresses), would it be worth extracting this into a helper in test_node.py or somewhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Functional tests: feature_bind_port_discover.py is failing Discover() will not run if listening on any address with an explicit bind=0.0.0.0

5 participants