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

Đang mở
#2,906 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
testing

Hướng nghiên cứu

Read tests/metrics/fixed_ports.rs and the random loopback helper added in #2393, then reproduce the collision by running the built test binary twice concurrently. Confirm the approach in the spec review, update the test and document why the ports remain fixed. Run 20 paired executions and confirm both runs pass.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Rust
Star
532
Fork
56
Merge trung bình
11 giờ 20 phút
Pull request đã merge (30 ngày)
282

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của torrust/torrust-tracker

Tất cả issue của torrust/torrust-tracker

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.