Skip to content

Absorb the hand-rolled IAsyncLifetime template in TenantPartitionedEventsTests - #5100

Merged
jeremydmiller merged 1 commit into
masterfrom
test/tpe-partitioned-context
Aug 1, 2026
Merged

Absorb the hand-rolled IAsyncLifetime template in TenantPartitionedEventsTests#5100
jeremydmiller merged 1 commit into
masterfrom
test/tpe-partitioned-context

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Phase 2 of the test-harness standardization program (HANDOFF-test-harness-standardization.md): 18 TenantPartitionedEventsTests files re-declared the same copy-paste IAsyncLifetime lifecycle (drop pid+guid schema → DocumentStore.For with the common partitioned config → EnsureStorageExistsAsync → dispose). They now inherit Fixtures/PartitionedStoreContext, declaring only a SchemaPrefix and a ConfigureStore override with their file-local event types/projections/flags. Net −449 lines.

ConfigureStore runs after the common config lines (Conjoined, UseTenantPartitionedEvents, QuickWithServerTimestamps, AllDocumentsAreMultiTenanted), so per-file deviations still work by overriding in place. Virtual hooks cover the non-template cases:

  • EnsureStorageOnInitialize => falseevent_metadata_propagation_under_partitioning
  • DropSchemaOnInitialize => false + BuildSchemaName() override — per_tenant_rebuild_cancellation (stable rebuild_cancel_{pid} schema)
  • InitializeAsync overrides for static-state resets — determine_action_async_per_tenant, raw_iprojection_per_tenant
  • re-entrant BuildFreshStoreAsync()Bug_4596's concurrency test rebuilds the whole store per attempt

Deliberately not migrated (classified before writing the base):

  • Migration/conjoined_to_partitioned_migration.cs — two structurally different stores, one deliberately not partitioned.
  • Regressions/Bug_5044_natural_key_table_migration.cs — holds no store; repeated store construction is the behavior under test.
  • All 18 Sharded/* files — they share a different, already-uniform template (collection fixture + 3-shard scrub + BuildStore() in test bodies). Four of them omit the QuickWithServerTimestamps line, so a naive shared base would change what they test; a dedicated sharded base is a candidate follow-up.

Verification: TPE suite net9.0 238 passed / 0 failed / 2 pre-existing skips; net10.0 compiles clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01U99pVx6kXwiGmaBUGLv7jB

…entsTests

Phase 2 of the test-harness standardization program. Eighteen files
re-declared the same per-class store lifecycle (drop a pid+guid schema, build
a DocumentStore with the common partitioned-tenancy config, ensure event
storage, dispose). The new Fixtures/PartitionedStoreContext base owns that
lifecycle; subclasses declare a SchemaPrefix and put only their file-local
event types/projections/flags in a ConfigureStore override, which runs after
the common config so it can override any line of it.

Virtual hooks cover the deviants: EnsureStorageOnInitialize=false
(event_metadata_propagation), DropSchemaOnInitialize=false + custom
BuildSchemaName (per_tenant_rebuild_cancellation), InitializeAsync overrides
for static-state resets (determine_action_async, raw_iprojection), and a
re-entrant BuildFreshStoreAsync for Bug_4596's per-attempt store rebuild.
schema_update_preserves_existing_per_tenant_sequences picks up ProcessId in
its schema name via the base — an isolation improvement, not a change in
what it tests.

Left out on purpose: Migration/conjoined_to_partitioned_migration (two
structurally different stores, one deliberately unpartitioned),
Regressions/Bug_5044_natural_key_table_migration (repeated store
construction IS the test), and all of Sharded/* (a different, already
uniform collection-fixture template — candidate for its own sharded base
in a later pass).

Net -449 lines. TPE suite net9.0: 238 passed, 0 failed, 2 pre-existing
skips; net10.0 compiles.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U99pVx6kXwiGmaBUGLv7jB
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