Flake: a_refused_connection_is_not_retried races other tests for its freed port

Offen Anfängerfreundlich
#2,424 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
76/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
rust
Bereich
cli, testing

Rechercherichtung

Beginne mit crates/socket-patch-core/tests/api_retry_e2e.rs, insbesondere mit a_refused_connection_is_not_retried und dem im Issue beschriebenen Listener-Setup. Prüfe, wie der Test während seiner Assertions einen gebundenen, nicht lauschenden Socket offenhalten kann, und führe dann diesen Integrationstest aus. Als erledigt gilt die Aufgabe, wenn der Port für parallele Tests weiterhin nicht verfügbar ist und die Assertion weiterhin ApiError::Network verlangt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
Rust
Sterne
9
Forks
2
Ø Merge
1 T. 2 Std.
Gemergte PRs (30 T.)
213

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus SocketDev/socket-patch

Alle Issues in SocketDev/socket-patch

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.