Re-enables BDD_SCHEMA_ISOLATION=true with the foundation from PR #34
(NewPostgresRepositoryFromDSN). Achieves ~2.85x speedup on the BDD
test suite by running feature packages in parallel.
ARCHITECTURE
When BDD_SCHEMA_ISOLATION=true, each test package (process) gets its
own isolated PostgreSQL schema:
1. testserver.Start() generates a deterministic schema name per FEATURE
2. CREATE SCHEMA <name>
3. Open a per-package gorm.DB with DSN search_path=<name>
4. AutoMigrate runs in the isolated schema (creates users table)
5. Build a per-package server.Server with this isolated repo via
server.NewServerWithUserRepo
6. Stop() drops the schema + closes the per-package pool
Packages then run in parallel (default Go test parallelism) without
contention because each has its own schema + connection pool.
CHANGES
- pkg/server/server.go : NEW factory NewServerWithUserRepo(cfg, ctx,
userRepo, userService) that injects a per-test repo. Existing NewServer
becomes a thin wrapper.
- pkg/bdd/testserver/server.go : Start() chooses isolated mode based on
BDD_SCHEMA_ISOLATION env var. Stop() drops schema + closes pool.
- pkg/user/postgres_repository.go : Exec(sql) helper for the schema
lifecycle (CREATE/DROP) used by testserver.
- scripts/run-bdd-tests.sh : -p 1 only when BDD_SCHEMA_ISOLATION!=true.
When true, default Go parallelism (~ NumCPU packages concurrent).
- .gitea/workflows/ci-cd.yaml : exports BDD_SCHEMA_ISOLATION=true.
- adr/0025-bdd-scenario-isolation-strategies.md : Status to "Implemented".
VALIDATION
5x AuthBDD with isolation: 5/5 PASS, public.users count=0 after runs.
Local benchmark on the full features/... suite:
- Sequential -p 1 (no isolation): 12.87s
- Parallel + isolation (this PR): 4.51s
- Speedup: 2.85x
🤖 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add swag fmt to git pre-commit hook and CI/CD pipeline
- Create comprehensive CONTRIBUTING.md guide with AI section
- Update ADR-0013 with swag fmt documentation
- Fix swagger generation to include all endpoints
- Improve local testing scripts and workflows
- Update Dockerfile for better swagger handling
- Fix CI/CD workflow file references
- Add ADR-0012 documenting the decision to format only staged Go files
- Update ADR README.md with new entry
- Document rationale, alternatives, and verification results
- Include future considerations for monitoring and CI/CD integration
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- Added /api/v2/greet POST endpoint with JSON request/response
- Implemented ServiceV2 with Hello my friend <name>! greeting format
- Added api.v2_enabled feature flag (default: false)
- Extended BDD tests to cover v2 scenarios
- Maintained full backward compatibility with v1 API
- Added DLC_API_V2_ENABLED environment variable support
- Created ADR 0010-api-v2-feature-flag.md
- Updated configuration system to support API versioning
Implement comprehensive BDD testing framework using Godog:
- Added feature files for greet and health endpoints
- Created test server that runs on port 9191
- Implemented step definitions using Godog's exact patterns
- Fixed undefined step warnings by following Godog conventions
- All tests passing with proper response validation
- Maintained black box testing principles
Key files:
- pkg/bdd/steps/steps.go - Step definitions using StepContext struct
- pkg/bdd/testserver/ - Test server implementation
- features/*.feature - BDD feature files
- pkg/bdd/README.md - Documentation for proper step patterns
The implementation follows Godog's exact pattern suggestions to avoid
undefined step warnings and provides comprehensive API testing.