Repository navigation
refactor(test): use container-based postgres_tls for TLS SQL tests - #26518
Conversation
Refactors tls-sql.test.ts to use describeWithContainer with a local postgres_tls Docker container instead of relying on external Neon secrets. Changes: - Update docker-compose.yml to build postgres_tls from Dockerfile instead of using volume mounts (fixes SSL key permission issues) - Fix Dockerfile pg_hba.conf to allow local socket connections for init scripts and use broader CIDR ranges for remote TLS connections - Update health check to use start_interval for faster startup detection - Add postgres_tls to the list of services that need building in index.ts - Simplify test file to use describeWithContainer pattern with prepare on/off Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Updated 10:02 PM PT - Jan 27th, 2026
❌ Your commit
🧪 To try this PR locally: bunx bun-pr 26518That installs a local version of the PR into your bun-26518 --bun |
WalkthroughSwitches the test PostgreSQL TLS service to a locally-built image with added startup flags and extended healthcheck timing, broadens pg_hba.conf to allow remote TLS, adds Changes
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
test/docker/index.ts (1)
388-390: Include postgres_tls in buildServices() to keep CI prep complete.
Line 389 still omits postgres_tls, soprepareImages()won’t prebuild the TLS image even though it now requires building. Please add it toservicesToBuild.♻️ Suggested fix
- const servicesToBuild = ["mysql_tls", "redis_unified"]; + const servicesToBuild = ["mysql_tls", "redis_unified", "postgres_tls"];
🤖 Fix all issues with AI agents
In `@test/js/sql/tls-sql.test.ts`:
- Around line 8-15: Two parallel test suites use describeWithContainer with
concurrent: true causing both beforeAll hooks to call
dockerHelper.ensure("postgres_tls") and race on docker-compose up; fix by making
the container setup single-threaded: either set concurrent: false on the
describeWithContainer that uses image "postgres_tls" or merge the two suites
into one describeWithContainer and move the for (const prepare of [true, false])
loop inside it so only one beforeAll/dockerHelper.ensure() runs; update
references to describeWithContainer, beforeAll, and dockerHelper.ensure
accordingly.
Move the for loop inside the describeWithContainer callback to ensure only one beforeAll/dockerHelper.ensure() runs, avoiding the race condition where two parallel test suites would both try to start the postgres_tls container. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@test/js/sql/tls-sql.test.ts`:
- Around line 26-33: The test double-disposes the SQL connection: the `await
using sql = new SQL(getOptions())` line will automatically dispose `sql` at
scope exit, so remove the explicit `await sql.close()` call to avoid a
double-close; locate the test function (tls (explicit)) and delete the final
`await sql.close();` so that disposal is handled solely by the `using`/disposer
for the `SQL` instance.
- Around line 97-113: The test currently masks the real error by converting any
rejection to the string "fail"; update the assertion to capture and assert the
actual thrown error message instead: when using sql.begin and sql.savepoint in
the "Transaction throws on uncaught named savepoint" test, replace the .catch(()
=> "fail") handler with one that returns the caught error's message (e.g., e =>
e.message) and assert that the message equals "fail" so the test verifies the
real error thrown by the savepoint.
- Remove explicit sql.close() call since await using already handles disposal - Fix assertion to capture actual error message instead of masking it Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@test/js/sql/tls-sql.test.ts`:
- Around line 114-136: The test "Transaction succeeds on caught savepoint"
creates a persistent table; change the CREATE statement in that test to create a
temporary table instead by replacing the SQL`CREATE TABLE IF NOT EXISTS
${sql(random_name)} (a int)` call inside the test with a TEMPORARY variant
(e.g., SQL`CREATE TEMPORARY TABLE IF NOT EXISTS ${sql(random_name)} (a int)`) so
it matches other tests and prevents persistence if cleanup fails; locate this in
the test function around the random_name and SQL usage (sql`...`) and update the
SQL string accordingly.
Change CREATE TABLE to CREATE TEMPORARY TABLE to match other tests and prevent persistence if cleanup fails. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ven-sh#26518) ## Summary - Refactors `tls-sql.test.ts` to use `describeWithContainer` with a local Docker container instead of external Neon secrets - Updates `postgres_tls` service to build from Dockerfile (fixes SSL key permission issues) - Fixes pg_hba.conf to allow local socket connections for init scripts ## Test plan - [x] Verified tests pass locally with `bun bd test test/js/sql/tls-sql.test.ts` (30 tests pass) - [ ] CI passes on x64 Linux (arm64 Docker tests are currently disabled) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Summary
tls-sql.test.tsto usedescribeWithContainerwith a local Docker container instead of external Neon secretspostgres_tlsservice to build from Dockerfile (fixes SSL key permission issues)Test plan
bun bd test test/js/sql/tls-sql.test.ts(30 tests pass)🤖 Generated with Claude Code