Skip to content

[Feature] Parallel-test stability (TCP/UDP/WebSocket/Filesystem under load) #290

@pathosDev

Description

@pathosDev

Size / Priority

  • Size: M — diagnostic + fix per offender.
  • Category: C.4 Test-Infrastructure.
  • Risk: medium — flaky tests are notoriously hard.

Affected files

  • tests/multi-node/tcp-*, tests/multi-node/udp-*, tests/multi-node/websocket-*, tests/unit/persistence/filesystem-* — tests that fail under parallel execution load.

Background

Some tests pass reliably in isolation but fail under parallel execution. Root causes:

  • Port collisions — TCP/UDP tests claim ephemeral ports; under load, two tests grab the same port before either binds.
  • Filesystem races — concurrent tests writing to same temp dir.
  • WebSocket connect/disconnect races — handshake state.
  • Resource exhaustion — too many open sockets under stress.

These tests typically have a flake rate of 1-5%. CI sometimes retries; flake rates rise over time.

Target

Per-offender investigation + fix:

  1. TCP/UDP: use unique port ranges per test (e.g., bind to port 0 for ephemeral allocation, then read assigned port).
  2. Filesystem: each test gets its own UUID-named temp dir.
  3. WebSocket: serialise these via test-runner serialisation hints (it.serial if available, or move to a dedicated workspace).
  4. Resource limits: per-test cleanup + reduced concurrency for resource-heavy tests.

Alternative: a testkit-isolation mode that ensures problematic tests run sequentially while everything else runs parallel.

Integration / risk

  • Each fix is small but the diagnosis is hard.
  • May require test-runner config changes.

Test plan

  1. Catalog offenders: enumerate failing tests with their failure modes.
  2. Per-offender fix.
  3. Stress test: run suite N times under parallel load; verify <0.1% flake.

Acceptance criteria

  • Catalog of flaky tests with root causes.
  • Per-test fix.
  • Stress run shows reliable pass rate.
  • Documentation: "Diagnosing test flakes".
  • No CHANGELOG entry needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority: lowNice-to-have / niche / demand-driven

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions