Skip to content

test(node): Use random port in hono tracing scenario to avoid CI flakes#21536

Merged
mydea merged 1 commit into
developfrom
fix/hono-tracing-test-random-port
Jun 15, 2026
Merged

test(node): Use random port in hono tracing scenario to avoid CI flakes#21536
mydea merged 1 commit into
developfrom
fix/hono-tracing-test-random-port

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Fixes the flaky suites/tracing/hono/test.ts Node integration test (should handle transactions for all route/method/path combinations).

Root cause

The Hono tracing scenario binds its server to a hardcoded port 8787:

const port = 8787;
serve({ fetch: app.fetch, port });
sendPortToRunner(port);

The integration-test runner explicitly warns against this — a fixed port is fine for local debugging but "dangerous for CI/CD environments where port collisions can cause flakes". When port 8787 is already in use (e.g. a not-yet-fully-killed child process from a prior run, or another concurrent suite), @hono/node-server fails to bind, the scenario never serves requests on a usable socket, and the runner times out waiting for transactions — surfacing as an intermittent failure.

The sibling suites/hono-sdk/scenario.mjs already uses the correct pattern: bind to port 0 (OS-assigned free port) and report the actually-bound port back to the runner via the serve callback. This change mirrors that:

serve({ fetch: app.fetch, port: 0 }, info => {
  sendPortToRunner(info.port);
});

Test behavior and assertions are unchanged — only the port allocation strategy is fixed, eliminating the collision window.

Fixes #21174

Fixes #21174

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot requested a review from a team as a code owner June 15, 2026 12:30
@github-actions github-actions Bot requested review from JPeer264 and mydea and removed request for a team June 15, 2026 12:30
@mydea mydea enabled auto-merge (squash) June 15, 2026 12:52
@mydea mydea merged commit 5da0cc9 into develop Jun 15, 2026
48 checks passed
@mydea mydea deleted the fix/hono-tracing-test-random-port branch June 15, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant