Skip to content

MOS-11: Add repository contract test suite - #14

Merged
timoruohomaki merged 1 commit into
masterfrom
test/MOS-11-repository-contract
Nov 8, 2026
Merged

timoruohomaki merged 1 commit into
masterfrom
test/MOS-11-repository-contract

Conversation

@timoruohomaki

Copy link
Copy Markdown
Contributor

repotest.Run checks any repository.Repository implementation: CRUD, not-found and duplicate errors, running order versions and stale-update conflicts, list ordering, parent checks, cascade deletes and copy semantics.

  • repository/errors.go: shared ErrNotFound, ErrAlreadyExists, ErrVersionConflict; the package comment states the contract.
  • repository/memory: in-memory reference implementation that runs the suite in CI (go test ./...) until the PostgreSQL store exists.
  • Mongo repositories wrap the shared errors, return ErrNotFound when updating a missing record, and require the stored version on update.

repotest.Run checks any repository.Repository implementation: CRUD,
not-found and duplicate errors, running order versions and stale-update
conflicts, list ordering, parent checks, cascade deletes and copy
semantics.

- repository/errors.go: shared ErrNotFound, ErrAlreadyExists,
  ErrVersionConflict; the package comment states the contract.
- repository/memory: in-memory reference implementation that runs the
  suite in CI (go test ./...) until the PostgreSQL store exists.
- Mongo repositories wrap the shared errors, return ErrNotFound when
  updating a missing record, and require the stored version on update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@timoruohomaki
timoruohomaki merged commit 9a6f7f9 into master Nov 8, 2026
3 checks passed
@timoruohomaki
timoruohomaki deleted the test/MOS-11-repository-contract branch November 8, 2026 17:37
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