40 lines
1.0 KiB
Markdown
40 lines
1.0 KiB
Markdown
|
|
# ADR-006: In-Memory Adapters for Testing
|
||
|
|
|
||
|
|
## Status
|
||
|
|
Accepted
|
||
|
|
|
||
|
|
## Context
|
||
|
|
The domain model needs to be tested without external dependencies (PostgreSQL, S3, etc.). We need fast, isolated tests that verify domain behavior.
|
||
|
|
|
||
|
|
## Decision
|
||
|
|
Implement in-memory adapters for all repository interfaces:
|
||
|
|
- InMemoryFieldSessionRepository
|
||
|
|
- InMemoryMissionRepository
|
||
|
|
- InMemoryDecisionCaseRepository
|
||
|
|
- InMemoryArtifactRegistry
|
||
|
|
- InMemoryEventStore
|
||
|
|
- InMemoryUnitOfWork
|
||
|
|
|
||
|
|
These adapters:
|
||
|
|
- Implement the same interfaces as production adapters
|
||
|
|
- Store data in memory (Map, Array)
|
||
|
|
- Can be reset between tests
|
||
|
|
- Are never used in production
|
||
|
|
|
||
|
|
## Consequences
|
||
|
|
|
||
|
|
### Positive
|
||
|
|
- Tests run in milliseconds
|
||
|
|
- No database setup required
|
||
|
|
- Parallel test execution safe
|
||
|
|
- Documents how repositories are used
|
||
|
|
|
||
|
|
### Negative
|
||
|
|
- Not production-realistic (no transactions, no persistence)
|
||
|
|
- Need separate integration tests for production adapters
|
||
|
|
|
||
|
|
## Related
|
||
|
|
- ADR-001: Domain knows nothing about AI
|
||
|
|
- ADR-002: Artifact is common base contract
|
||
|
|
- ADR-003: Event Sourcing for traceability
|