Skip to content

test(sql): use describeWithContainer in sql-prepare-false so it skips on the darwin agent where docker hangs - #33986

Merged
dylan-conway merged 1 commit into
mainfrom
farm/0dd59bdd/sql-prepare-false-describeWithContainer
Jul 11, 2026
Merged

test(sql): use describeWithContainer in sql-prepare-false so it skips on the darwin agent where docker hangs#33986
dylan-conway merged 1 commit into
mainfrom
farm/0dd59bdd/sql-prepare-false-describeWithContainer

Conversation

@robobun

@robobun robobun commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

What

Fixes test/js/sql/sql-prepare-false.test.ts going red on darwin x64 CI with timeout (and occasionally crash reported) since the darwin-x64-mini-1 agent joined the test-darwin queue around build 70660.

Seen in builds 70820, 70844, 70855, 70866, 70909, 70964, 70976, 71002, 71019, 71040, 71172, 71187, 71234, 71293, 71443, 71453, 71495, 71701, 71806, 71828, 71934 (always on darwin-x64-mini-1-1, passes on every other darwin agent).

Cause

sql-prepare-false.test.ts was the only file in test/js/sql/ that called dockerCompose.ensure("postgres_plain") directly from an async describe instead of going through the isDockerEnabled() / describeWithContainer guard that every other container-backed sql test uses.

On darwin-x64-mini-1 the docker client is on PATH but talking to it blocks: the valkey tests' Bun.spawnSync([docker, "info"], {timeout: 5_000}) hits its 5s timeout on the same agent, while isDockerEnabled() (which goes through node execSync) returns false in under 100ms. So ensure()'s Bun.spawn(["docker", "version"]) / compose up path hung until the runner's 180s per-file timeout killed the process with nothing printed after the bun test banner.

From build 71293's darwin-x64-mini-1 shard:

--- [927/1066] test/js/sql/sql-prepare-false.test.ts
bun test v1.4.0-canary.1 (0809bdd14)
--- [927/1066] test/js/sql/sql-prepare-false.test.ts - timeout
... 4 attempts, each exactly 180s ...

while on the same shard every neighboring describeWithContainer-guarded file skips in under 100ms:

--- [913/1066] test/js/sql/postgres-binary-numeric.test.ts
Ran 0 tests across 1 file. [68.00ms]
--- [924/1066] test/js/sql/sql-mysql.test.ts
Ran 0 tests across 1 file. [75.00ms]

In build 71934 the non-zero exit also tripped the runner's crash-report drain, so stale intentional crashes from run-crash-handler.test.ts (crashByPanic, 0xDEADBEEF, outOfMemory) and a bundler native-plugin crash were attributed to this file and it surfaced as crash reported instead of timeout. That is the known limitation commented at scripts/runner.node.mjs:1453.

Fix

Move the file onto describeWithContainer("...", { image: "postgres_plain" }, container => ...), the same pattern used by postgres-binary-numeric.test.ts, postgres-prepared-pipeline-reorder.test.ts, postgres-simple-query-pipeline.test.ts and the other recent postgres tests. That helper already short-circuits on !isDockerEnabled() with a describe.todo, which is what every other sql test on that agent does today.

Also drops the afterAll(dockerCompose.down()) which tore down the whole compose project (all services) for later files on the same shard; describeWithContainer intentionally leaves the shared containers up.

Verification

All 8 cases still pass against a real postgres:

$ bun bd test test/js/sql/sql-prepare-false.test.ts
Container ready via docker-compose: postgres_plain at 127.0.0.1:5432
(pass) PostgreSQL prepare: false > basic parameterized query
(pass) PostgreSQL prepare: false > multiple parameterized queries sequentially
(pass) PostgreSQL prepare: false > same query repeated with different params
(pass) PostgreSQL prepare: false > concurrent queries with different tables return correct results
(pass) PostgreSQL prepare: false > parameterized query with multiple params
(pass) PostgreSQL prepare: false > query without params still works
(pass) PostgreSQL prepare: false > transactions with parameterized queries
(pass) PostgreSQL prepare: false > concurrent parameterized queries with high concurrency
 8 pass  0 fail

#31671 also touches this file for a different reason (making isDockerEnabled() throw on macOS CI when docker is absent); that change stacks cleanly on top of this one since describeWithContainer already routes through isDockerEnabled().

The test was added in #27952; the hang was exposed when darwin-x64-mini-1 joined the fleet.


[stamp-90s] gate passed · iteration 0 · 1 files touched

passes on PR (with fix)
Test-only change.

Debug/ASAN (expected pass):
$ bun bd test 'test/js/sql/sql-prepare-false.test.ts'
$ BUN_DEBUG_QUIET_LOGS=1 bun scripts/build.ts --profile=debug --quiet test test/js/sql/sql-prepare-false.test.ts
info: syncing channel updates for nightly-2026-05-06-x86_64-unknown-linux-gnu
info: latest update on 2026-05-06 for version 1.97.0-nightly (e95e73209 2026-05-05)
info: component rust-src is up to date
info: checking for self-update (current version: 1.29.0)
bun test v1.4.0 (c992b92f1)

test/js/sql/sql-prepare-false.test.ts:
Container ready via docker-compose: postgres_plain at 127.0.0.1:5432
(pass) PostgreSQL prepare: false > basic parameterized query [243.39ms]
(pass) PostgreSQL prepare: false > multiple parameterized queries sequentially [70.17ms]
(pass) PostgreSQL prepare: false > same query repeated with different params [110.18ms]
(pass) PostgreSQL prepare: false > concurrent queries with different tables return correct results [138.41ms]
(pass) PostgreSQL prepare: false > parameterized query with multiple params [41.32ms]
(pass) PostgreSQL prepare: false > query without params still works [30.85ms]
(pass) PostgreSQL prepare: false > transactions with parameterized queries [122.23ms]
(pass) PostgreSQL prepare: false > concurrent parameterized queries with high concurrency [248.81ms]

 8 pass
 0 fail
 73 expect() calls
Ran 8 tests across 1 file. [3.46s]
Exit: 0
diff hotspot
test/js/sql/sql-prepare-false.test.ts | 63 ++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 35 deletions(-)

gate history · 1 passed · 0 rejected · iteration 0

evidence per changed file
file                                   reads  edits  tests
test/js/sql/sql-prepare-false.test.ts      1      1      0

…s on darwin agents where the docker client hangs

sql-prepare-false.test.ts was the only sql test that called
dockerCompose.ensure() directly from an async describe without the
isDockerEnabled()/describeWithContainer guard. On darwin-x64-mini-1
(added to the test-darwin queue around build 70660) the docker client is
on PATH but talking to it hangs, so ensure() blocked for the full 180s
runner timeout and the file was killed with nothing but the banner
printed. Every other describeWithContainer/isDockerEnabled-guarded sql
test on the same agent skips in under 100ms.

Also drops the afterAll(dockerCompose.down()) which tore down the whole
compose project for later files on the shard.
@robobun

robobun commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 9:52 AM PT - Jul 11th, 2026

@robobun, your commit c992b92 is still building in Build #71939, but has 1 failures so far (All Failures):

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Changes

SQL prepare-false test harness

Layer / File(s) Summary
Container harness and configuration
test/js/sql/sql-prepare-false.test.ts
Replaces manual Docker lifecycle management with describeWithContainer and changes the database configuration to an options() function.
Per-test SQL initialization
test/js/sql/sql-prepare-false.test.ts
Awaits container readiness before SQL construction and applies max overrides through the generated options.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: switching this SQL test to describeWithContainer to avoid Docker hangs on darwin.
Description check ✅ Passed The description covers the change and verification, though it uses custom headings instead of the template's exact section names.

Comment @coderabbitai help to get the list of available commands.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — mechanical refactor of a test file onto the shared describeWithContainer harness pattern.

What was reviewed:

  • Verified the new usage matches describeWithContainer's signature in test/harness.ts:1089 and the sibling pattern in postgres-binary-numeric.test.ts (await container.ready before reading host/port).
  • Confirmed options was correctly converted to a thunk so container.host/container.port are read after beforeAll populates them via the live getters.
  • Confirmed the dropped afterAll(dockerCompose.down()) is intentional and consistent with other describeWithContainer callers, which leave the shared compose project up.
Extended reasoning...

Overview

This PR touches a single test file, test/js/sql/sql-prepare-false.test.ts, converting it from a hand-rolled async describe + dockerCompose.ensure() pattern to the shared describeWithContainer("...", { image: "postgres_plain" }, container => ...) helper that every other container-backed SQL test in test/js/sql/ already uses. The 8 test bodies are unchanged aside from adding await container.ready and calling options() as a thunk instead of referencing a captured object.

Security risks

None. This is a test-infrastructure-only change with no production code, no new inputs, and no auth/crypto surface.

Level of scrutiny

Low. The change is mechanical alignment with an established, widely-used harness helper. I read describeWithContainer in test/harness.ts to confirm: it gates on isDockerEnabled() and falls back to describe.todo (fixing the darwin hang), exposes host/port via live getters populated in beforeAll, and provides a ready promise — all of which the new code uses correctly. The options closure was correctly converted to a thunk so it reads the getters after beforeAll runs, not at describe time when port is still 0.

Other factors

  • The removed afterAll(dockerCompose.down()) was actively harmful (tore down the whole compose project for later tests on the same shard); no other describeWithContainer caller does teardown, so removing it is correct.
  • The PR description includes verified local run output showing all 8 tests still pass against a real postgres.
  • No prior reviewer comments to address; timeline only contains the robobun build link.

@robobun

robobun commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author

Confirmed on CI: on darwin-x64-15.0-1 in build 71939 the file now skips cleanly instead of hanging:

--- [3/1070] test/js/sql/sql-prepare-false.test.ts
bun test v1.4.0-canary.1 (c992b92f1)
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
0 pass  0 fail
Ran 0 tests across 1 file. [64.00ms]

The only red in the build is test/js/node/test/parallel/test-worker-message-port-transfer-terminate.js on debian 13 x64-asan, a known main break tracked by #33418 / #33966 and unrelated to this test-only change.

@dylan-conway
dylan-conway merged commit 588da0e into main Jul 11, 2026
60 of 71 checks passed
@dylan-conway
dylan-conway deleted the farm/0dd59bdd/sql-prepare-false-describeWithContainer branch July 11, 2026 16:58
robobun added a commit that referenced this pull request Jul 12, 2026
main added its own pgParseComplete/pgBindComplete/pgParameterDescription and a
two-arg pgReadFrontendMessages in #33962; drop the duplicates this PR had
introduced (keeping pgCloseComplete and pgReadCString, which main does not
have) and rewrite the mock server to handle StartupMessage inline like the
other fault-injection fixtures now do.

Switch the real-server test to describeWithContainer (harness), matching the
shape #33986 moved sql-prepare-false to so the test skips correctly on agents
where docker is unavailable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants