Skip to content

chore(dev): local test stack matches CI - #591

Merged
angel-manuel merged 1 commit into
devfrom
chore/local-test-services-parity
Aug 31, 2026
Merged

chore(dev): local test stack matches CI#591
angel-manuel merged 1 commit into
devfrom
chore/local-test-services-parity

Conversation

@angel-manuel

Copy link
Copy Markdown
Contributor

cargo test --workspace could not pass on a fresh local checkout, for two independent reasons — and both failed in a way that reads as a broken branch rather than a missing container.

Valkey was simply absent

oversla-sh's integration tests panic by design when VALKEY_URL is unreachable, so 14 tests failed on every local run. CI has had a valkey service all along.

  • make local-db now starts Valkey next to Postgres.
  • bin/worktree-env.sh allocates a per-worktree Valkey port and writes VALKEY_HOST_PORT, VALKEY_URL, and REDIS_URL into .env.local (which make re-exports).
  • REDIS_URL is the second name deliberately: with it set, the resolver cache (D64) and the rate limiter exercise their Redis backend locally the way they do in CI, instead of quietly falling back to the in-memory store.

Postgres was the subtler one

With Valkey up, the api suite still failed by the hundred — tests that pass one at a time. Each holds two pools (the test's own and the in-process API server's) against a database it clones from a template, and the stock max_connections = 100 runs out long before the suite does. CI raises the same knob to 500 in its "Tune Postgres" step; the dev compose Postgres now sets it too.

Making the trap unreachable rather than merely documented

  • make test prefers cargo nextest run --workspace — what CI runs, and the per-process isolation a handful of env-var tests want — falling back to cargo test --workspace -- --test-threads=4, the number CLAUDE.md already recommended.
  • make test / make check preflight both services via scripts/check-test-services.sh, which prints run make local-db instead of a wall of connection errors.
  • The shortener dev stack moves to its own SHORTENER_VALKEY_HOST_PORT (6390) so it can run alongside the test store rather than fighting it for 6380.
  • The hint in crates/oversla-sh/tests/integration.rs now points at make local-db; docs updated in CLAUDE.md and .env.example.

Verification

Full workspace suite in a worktree, from make local-dbmake migratemake test:

Summary [171.279s] 2721 tests run: 2721 passed, 13 skipped

cargo fmt --check, check-line-counts.sh, check-decisions.sh, and the pre-commit clippy gate are clean. No production code changes — dev tooling, compose, and docs only.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RZvFwDS6Vm7xb17dExGLfm

`cargo test --workspace` could not pass on a fresh local checkout, for two
independent reasons — and both failed in a way that read as a broken branch
rather than a missing container.

Valkey was simply absent. `oversla-sh`'s integration tests panic by design
when `VALKEY_URL` is unreachable, so 14 tests failed on every local run; CI
has had a `valkey` service all along. `make local-db` now starts it next to
Postgres, `bin/worktree-env.sh` allocates a per-worktree port, and both
`VALKEY_URL` and `REDIS_URL` land in `.env.local` — the second name so the
resolver cache and rate limiter exercise their Redis backend locally the way
they do in CI, instead of quietly falling back to the in-memory store.

Postgres was the subtler one. With Valkey up, the api suite still failed by
the hundred — tests that pass one at a time. Each holds two pools against a
database it clones from a template, and the stock `max_connections = 100`
runs out long before the suite does. CI raises the same knob to 500 in its
"Tune Postgres" step; the dev compose Postgres now sets it too.

The rest is making the trap unreachable rather than merely documented:
`make test` prefers nextest (what CI runs, and per-process isolation the
env-var tests want) and otherwise caps threads at 4, and `make test` /
`make check` preflight both services with a hint instead of a wall of
connection errors. The shortener stack moves to its own
`SHORTENER_VALKEY_HOST_PORT` so it can run alongside the test store.

Verified locally: 2721 passed, 13 skipped, 0 failed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RZvFwDS6Vm7xb17dExGLfm
@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
overslash Ready Ready Preview Aug 31, 2026 3:56pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

Code diff size

+0 / −0 across 0 files (net +0)

No production source files changed.

Source files under src/ only (.cjs, .go, .js, .jsx, .mjs, .py, .rs, .svelte, .ts, .tsx); test files and inline #[cfg(test)] modules excluded. 8 other changed files not counted.

@angel-manuel
angel-manuel enabled auto-merge (squash) August 31, 2026 16:02
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@angel-manuel
angel-manuel disabled auto-merge August 31, 2026 16:05
@angel-manuel
angel-manuel merged commit 153ac5d into dev Aug 31, 2026
15 checks passed
@angel-manuel
angel-manuel deleted the chore/local-test-services-parity branch August 31, 2026 16:05
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