Skip to content

test: prove the migration connect cap against a black-holed host #1122

Open

Description

@chappie-daemon

nostream-cli migrate pg-to-lmdb bounds its first connection to the source with MIGRATION_CONNECT_CAP_MS (10 s) and one direct PgConnection::connect_with attempt. The bound is proven by inversion — removing the direct attempt makes the same test take 60.017 s and fail its clock assertion — but no test exercises a host that drops packets, which is the only case the cap exists for.

Against a refused port the driver answers immediately, so the test passes without the cap doing anything.

Acceptance

A test with:

  • DB_URI=postgres://192.0.2.1:5432/nostream (RFC 5737 TEST-NET-1: reserved for documentation, not routed, packets dropped)
  • DB_ACQUIRE_CONNECTION_TIMEOUT=60000, so the pool's value cannot be what bounds it
  • env_clear()

asserts exit 1 in under 25 s and stderr containing did not answer within the connect budget.

Why it is not in the migration branch

It is a duration test that depends on a host not answering. This job shipped three tests that passed for what the harness supplied (a local Postgres answering, a 60 s default, a root-run tempdir) and one that failed only as root; a network-dependent duration assertion is the same class with a narrower window, and ten seconds of suite time is not worth adding it to main one commit before the branch opens.

It belongs where a failure is informative — a nightly job, or a test marked #[ignore] with the reason in its name — rather than on the path every developer runs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions