Skip to content

fix: flaky TestByzantinePrevoteEquivocation and psql Docker port conflict#30

Open
JayT106 wants to merge 3 commits intocrypto-org-chain:v0.38.xfrom
JayT106:fix/flaky-tests
Open

fix: flaky TestByzantinePrevoteEquivocation and psql Docker port conflict#30
JayT106 wants to merge 3 commits intocrypto-org-chain:v0.38.xfrom
JayT106:fix/flaky-tests

Conversation

@JayT106
Copy link
Copy Markdown

@JayT106 JayT106 commented Mar 13, 2026

Summary

  • Byzantine test: Remove the hardcoded 20s time.After timeout in TestByzantinePrevoteEquivocation that flakes in slow CI environments. Use a blocking wg.Wait() instead, relying on the test's -timeout flag (default 10m) for the overall deadline.
  • psql test: Explicitly bind the PostgreSQL Docker container port to a random available host port (HostPort: "0") to avoid address already in use errors when port 5432 is occupied by a local PostgreSQL instance or a parallel test run.

…lict

- Remove 20s hardcoded timeout in TestByzantinePrevoteEquivocation that
  flakes in slow CI. Use blocking wg.Wait() instead, relying on the
  test's -timeout flag for overall deadline.

- Explicitly bind PostgreSQL container port to a random host port (":0")
  to avoid "address already in use" when port 5432 is taken by a local
  PostgreSQL or a parallel test run.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@JayT106 JayT106 self-assigned this Mar 13, 2026
JayT106 and others added 2 commits March 13, 2026 15:37
Move PortBindings to RunOptions (so it's set before dockertest applies
PublishAllPorts) and disable PublishAllPorts in the HostConfig callback.
This ensures Docker only creates a single random-port binding instead of
also trying to publish all exposed ports, which can race on CI and cause
"address already in use" errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@JayT106 JayT106 requested a review from songgaoye March 14, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant