Flake: a_refused_connection_is_not_retried races other tests for its freed port

オープン 初心者向け
#2,424 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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 の設定を調べてください。アサーションの実行中、テストでバインド済みかつ待ち受けていないソケットを保持する方法を確認し、その後この integration test を実行してください。完了条件は、ポートが並列テストで引き続き使用できず、アサーションが引き続き 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時間
マージ済み PR(30日)
213

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

SocketDev/socket-patch のほかの issue

SocketDev/socket-patch の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。