test: extend shared conformance suite to cover ALL store features #161

Closed
opened 2026-03-01 12:38:58 +00:00 by ash · 0 comments
Owner

Problem

eventstoretest.RunSuite only tests the basic EventStore interface (Append, Load, LoadFrom, concurrency, metadata). All extended features are tested ONLY in store-specific tests with no shared contract:

Not in shared suite:

  • LoadWithOptions (event type filter, version filter, limit)
  • LoadRaw / LoadRawWithOptions
  • AppendWithOptions (idempotency key when added)
  • Delete / Archive / Restore (EventStoreWithDeletion)
  • Tombstone / IsTombstoned
  • StreamStatus (StreamLifecycle)
  • Truncate
  • GlobalReader (ReadFrom, LatestSequence)
  • SnapshotStore (Save, Load, Invalidate, InvalidateAll)
  • CheckpointStore (Save, Load)
  • ChangeRelay (Broadcast, dedup)
  • SubscriptionAdapter

This means theres no guarantee pgstore and sqlitestore implement these the same way. Each store tests its own implementation independently — they could diverge without anyone noticing.

Solution

Extend eventstoretest with additional shared suites:

// Extended store features
eventstoretest.RunDeletionSuite(t, factory)      // Delete, Archive, Restore, Tombstone
eventstoretest.RunLifecycleSuite(t, factory)      // StreamStatus, ArchiveStream, DeleteStream, RestoreStream
eventstoretest.RunOptionsSuite(t, factory)        // LoadWithOptions, LoadRaw, AppendWithOptions
eventstoretest.RunGlobalReaderSuite(t, factory)   // ReadFrom, LatestSequence, ordering, gaps
eventstoretest.RunSnapshotSuite(t, factory)       // Save, Load, Invalidate, InvalidateAll
eventstoretest.RunCheckpointSuite(t, factory)     // Save, Load, overwrite, missing consumer
eventstoretest.RunTruncateSuite(t, factory)       // Truncate + verify empty

Each store calls these suites in its conformance test file. If a store doesnt support a feature, it skips that suite.

Factory interfaces

The factories need to return the extended interfaces:

type DeletionFactory func(t *testing.T) eskit.EventStoreWithDeletion[TestEvent]
type GlobalReaderFactory func(t *testing.T) (eskit.EventStore[TestEvent], subscription.GlobalReader[TestEvent])
// etc.

Requirements

  • Each suite tests the SAME behavior contract
  • Both pgstore and sqlitestore conformance tests call all applicable suites
  • If a new store is added, running the suites guarantees feature parity
  • Must pass for both stores
  • Update #139 (parity tracking) to reference these suites
## Problem `eventstoretest.RunSuite` only tests the basic EventStore interface (Append, Load, LoadFrom, concurrency, metadata). All extended features are tested ONLY in store-specific tests with no shared contract: **Not in shared suite:** - LoadWithOptions (event type filter, version filter, limit) - LoadRaw / LoadRawWithOptions - AppendWithOptions (idempotency key when added) - Delete / Archive / Restore (EventStoreWithDeletion) - Tombstone / IsTombstoned - StreamStatus (StreamLifecycle) - Truncate - GlobalReader (ReadFrom, LatestSequence) - SnapshotStore (Save, Load, Invalidate, InvalidateAll) - CheckpointStore (Save, Load) - ChangeRelay (Broadcast, dedup) - SubscriptionAdapter This means theres no guarantee pgstore and sqlitestore implement these the same way. Each store tests its own implementation independently — they could diverge without anyone noticing. ## Solution Extend `eventstoretest` with additional shared suites: ```go // Extended store features eventstoretest.RunDeletionSuite(t, factory) // Delete, Archive, Restore, Tombstone eventstoretest.RunLifecycleSuite(t, factory) // StreamStatus, ArchiveStream, DeleteStream, RestoreStream eventstoretest.RunOptionsSuite(t, factory) // LoadWithOptions, LoadRaw, AppendWithOptions eventstoretest.RunGlobalReaderSuite(t, factory) // ReadFrom, LatestSequence, ordering, gaps eventstoretest.RunSnapshotSuite(t, factory) // Save, Load, Invalidate, InvalidateAll eventstoretest.RunCheckpointSuite(t, factory) // Save, Load, overwrite, missing consumer eventstoretest.RunTruncateSuite(t, factory) // Truncate + verify empty ``` Each store calls these suites in its conformance test file. If a store doesnt support a feature, it skips that suite. ## Factory interfaces The factories need to return the extended interfaces: ```go type DeletionFactory func(t *testing.T) eskit.EventStoreWithDeletion[TestEvent] type GlobalReaderFactory func(t *testing.T) (eskit.EventStore[TestEvent], subscription.GlobalReader[TestEvent]) // etc. ``` ## Requirements - Each suite tests the SAME behavior contract - Both pgstore and sqlitestore conformance tests call all applicable suites - If a new store is added, running the suites guarantees feature parity - Must pass for both stores - Update #139 (parity tracking) to reference these suites
ash closed this issue 2026-03-10 08:05:30 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ash/eskit#161
No description provided.