Skip to content

Let two runs of the fixed-port metrics test share a machine #2906

Open

Description

@josecelano-bot

Parent EPIC: #2392

Goal

Two concurrent runs of the metrics-fixed-ports integration test on one machine both pass. The test keeps covering tracker listeners on fixed ports.

Background

The shared-resource audit (#2394, finding P2) found that tests/metrics/fixed_ports.rs starts the tracker with four listeners on fixed ports: 0.0.0.0:17091 and 17092 (HTTP), 17093 and 17094 (UDP). Within one suite run nothing else uses them, but a second run of the same test binary on the same machine binds the same addresses, and its tracker fails to start with AddrInUse.

Running the built test binary twice at the same time, 20 times, failed one of the two runs in every pair. This happens today on development machines where several AI agents run the suite on the host network. On the self-hosted runner the test runs inside docker build, where each build step has its own network namespace, so concurrent builds do not collide.

Candidate approach (to confirm in spec review)

Bind the four fixed ports on a random loopback address from torrust_tracker_test_helpers::random::loopback_ipv4() (added in #2393) instead of 0.0.0.0, so two runs use different addresses with the same ports; ignore the test off Linux. This extends the helper beyond the nine #2393 tests, which needs a maintainer decision in the EPIC. Another option is deleting the test if metrics-port-zero already covers the same contract.

Tasks

  • Reproduce the paired-run collision on current develop.
  • Change the test so concurrent runs do not collide, and document why the ports are fixed.
  • Recheck with 20 paired runs.

The full specification is added to docs/issues/open/ by a spec-only pull request.

Activity

  1. added 5 commits that reference this issue on Nov 17, 2026
  2. added a commit that references this issue on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions