Flake: a_refused_connection_is_not_retried races other tests for its freed port

未關閉 適合新手
#2,424 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
76/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
rust
領域
cli, testing

研究方向

從 crates/socket-patch-core/tests/api_retry_e2e.rs 開始,特別查看 a_refused_connection_is_not_retried 和 issue 中描述的 listener 設定。檢查測試如何在斷言期間保持一個已繫結但未監聽的 socket,然後執行這個整合測試。完成條件是該連接埠對平行測試仍不可用,而且斷言仍要求 ApiError::Network。

由索引模型根據 Issue 內容生成。

描述

agent:triaged ci-janitor priority:p3

[agent] Found while handling a merge-queue eviction of #2405 (a test-only change in the CLI crate that does not touch this code).

Problem

a_refused_connection_is_not_retried in crates/socket-patch-core/tests/api_retry_e2e.rs picks its "dead" port by binding 127.0.0.1:0, reading the port and dropping the listener. Tokio tests in the same binary run in parallel and start their own stand-in servers on 127.0.0.1:0, so one of them can be handed the port just freed. The request then reaches a live server instead of being refused.

Evidence

Merge-queue CI run 46744428179, job coverage (1):

thread 'a_refused_connection_is_not_retried' panicked at crates/socket-patch-core/tests/api_retry_e2e.rs:983:5:
Other("API request failed with status 404: 127.0.0.1:36553 did not answer like the Socket patch API — check --api-url / SOCKET_API_URL and the organization slug 'org' (--org / SOCKET_ORG_SLUG)")
test result: FAILED. 17 passed; 1 failed

Something answered 404 on the port the test expected to be closed. ci-ok failed on that job alone and the queue entry was evicted.

Suggested fix

Keep the port reserved and still refusing for the length of the test, so no other test can take it. One way: bind a socket to the port without calling listen and hold it until the assertions finish (a connect to a bound, non-listening TCP socket is refused on Linux, macOS and Windows). Don't loosen the assertion on ApiError::Network.


Generated by Claude Code

主要語言
Rust
星號
9
分支
2
平均合併
1 天 2 小時
30 天內合併 PR
213

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

SocketDev/socket-patch 的其他 Issue

查看 SocketDev/socket-patch 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。