Skip to content

feat: isolated test database & DX improvements#10

Merged
earhackerdem merged 8 commits intomasterfrom
feature/dx
Mar 22, 2026
Merged

feat: isolated test database & DX improvements#10
earhackerdem merged 8 commits intomasterfrom
feature/dx

Conversation

@earhackerdem
Copy link
Copy Markdown
Owner

@earhackerdem earhackerdem commented Mar 21, 2026

Summary

  • Isolated test database: New compose.test.yml with an ephemeral db-test service (tmpfs — no volumes, no cleanup needed). Tests never touch dev data, and make test can run alongside make dev with no port conflicts.
  • Safer make down: Now preserves volumes; added make clean for explicit destructive teardown.
  • Security: Added .env and .DS_Store to .gitignoresetup.sh generates real secrets into .env.
  • Hardened setup.sh: set -euo pipefail for fail-fast behavior.

Changes

File Change
.gitignore Add .env, .DS_Store
compose.test.yml Newdb-test (tmpfs), prestart-test, backend-test, playwright override
Makefile Split down/clean, rewrite test/test-backend with cleanup-on-failure
scripts/setup.sh set -eset -euo pipefail
README.md Updated commands table & test docs

Test plan

  • make setup — generates .env with secrets
  • make dev — start full dev stack, create some data
  • make test — E2E tests run against isolated db-test; dev data untouched
  • make test-backend — backend tests against isolated db-test
  • make test while make dev is running — no port conflicts
  • make down — stops containers, data preserved in volume
  • make clean — stops containers AND removes volumes

🤖 Generated with Claude Code

- Add .env.example as template with changethis placeholders for secrets
- Add scripts/setup.sh to generate .env with random secrets from .env.example
- Add Makefile with commands: setup, dev, up, down, logs, test, test-backend, generate-client
- Update README with Quick Start section, commands table and E2E test workflow

Made-with: Cursor
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

- Add .env and .DS_Store to .gitignore (security fix)
- Create compose.test.yml with ephemeral db-test (tmpfs), prestart-test,
  backend-test (no host port mapping), and playwright override
- Split make down (preserves volumes) from make clean (destructive)
- Rewrite make test / test-backend to use isolated test DB with
  cleanup-on-failure pattern
- Harden setup.sh with set -euo pipefail
- Update README with new commands and simplified test docs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@earhackerdem earhackerdem changed the title feat: improve developer experience with Makefile and setup script feat: isolated test database & DX improvements Mar 21, 2026
earhackerdem and others added 6 commits March 21, 2026 15:19
Remove `build:` from prestart and prestart-test since they share the
same image tag as backend/backend-test. BuildKit was racing to export
both to the same tag in parallel, causing "image already exists" errors.

Now only backend builds the image; prestart reuses it. Makefile targets
pre-build the image before starting services.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The .env file was added to .gitignore but never untracked from the index,
so generated secrets (SECRET_KEY, POSTGRES_PASSWORD, etc.) were still
being committed. This removes it from tracking while keeping the local file.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Extract shared environment variables into x-test-env YAML anchor in
  compose.test.yml, eliminating ~30 lines of duplication between
  prestart-test and backend-test services
- Remove unnecessary --reload flag from backend-test (tests don't need
  hot-reload)
- Add .env.example existence check in setup.sh before copying

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Drop compose.override.yml from COMPOSE_TEST to prevent Docker Compose
  from merging playwright's depends_on with the dev backend service,
  which cascaded into starting db, prestart, and backend alongside tests
- Add mailcatcher and full playwright definition to compose.test.yml so
  tests are fully self-contained
- Fix race condition in EditUser.tsx where the dialog closed before the
  query cache was refreshed, causing the table to show stale data

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reverts the EditUser.tsx race-condition fix (unrelated to this PR's scope).
Replaces `$(COMPOSE_TEST) down` with targeted `rm -sf` of test containers
so that `make test` no longer kills dev services started by `make dev`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use **/.DS_Store glob to catch nested occurrences
- Add playwright to test cleanup in Makefile
- Consolidate three sed calls into one in setup.sh
- Add Docker prerequisite note to README Quick Start

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@earhackerdem earhackerdem merged commit 477f1f7 into master Mar 22, 2026
3 checks passed
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