Skip to content

a_connection_error_is_retried can fail when the tests run in parallel #183

Closed

Description

Measured

crates/hodeishield-api/tests/api.rs, a_connection_error_is_retried: the test binds a listener on 127.0.0.1:0, reads the port, drops the listener and then expects every connection to that port to be refused. Another test running in parallel (mockito servers bind ephemeral ports) can take the same port in between, so the client connects, gets an answer and the test fails (retries is not 2). Seen once in a local cargo test --workspace; it passes when run alone.

Acceptance criteria

  • The test no longer depends on a port staying free: for example, keep a listener that accepts and immediately closes connections, or point the client at an address that refuses connections without racing other tests.
  • 50 consecutive runs of the hodeishield-api tests in parallel pass.

Activity

  1. d0ubl3g commented on Oct 15, 2026

    @d0ubl3g
    ContributorAuthor

    Fixed in 0.5.0 (#187): the listener stays bound for the whole test, so no other test can take its port. Before merging, 50 consecutive runs of the hodeishield-api tests in parallel passed with no failure.

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions