Skip to content

Migrate CoreTests hand-rolled stores and hosts onto the standard harnesses - #5106

Merged
jeremydmiller merged 1 commit into
masterfrom
chore/harness-coretests
Aug 1, 2026
Merged

Migrate CoreTests hand-rolled stores and hosts onto the standard harnesses#5106
jeremydmiller merged 1 commit into
masterfrom
chore/harness-coretests

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Phase-2 test-harness standardization, CoreTests hotspot (follows #5104/#5105). Net −168 lines, retiring ~20 hard-coded schema literals.

Migrated → HostedStoreContext (9 files; newly Compile-linked into CoreTests.csproj)

  • Bugs/Bug_4185, Bugs/Bug_4187, Bugs/Bug_5039 — ancillary-store bug tests; ancillary schemas derive from SchemaName
  • configuring_marten_with_async_extensions — the sample_registering_async_config_marten snippet line stays verbatim inside the configureServices lambda
  • document_store_diagnostics_tests (8 doc_diag_* literals) and document_store_usage_tests (6 doc_usage_* literals) — literal-schema assertions rewritten against SchemaName
  • lazy_ancillary_store_registration, setting_solo_mode_in_test_support
  • working_with_initial_data — deletes the file-local MartenHost wrapper; the Bug1495 raw store gets await using (was leaked on failure)

Migrated / cleaned within OneOffConfigurationsContext (4 files)

  • request_count_tracking — also fixes its wrong-order hand-rolled Dispose
  • migrate_from_guid_to_int_based_revisions — textbook StoreOptions + SeparateStore over the shared "migrations" literal
  • SessionOptionsTests — four leaked custom-connection stores become tracked SeparateStore calls
  • EventTracingConnectionLifetimeTests — one stray undisposed store gets await using

Deliberately untouched (classified, not skipped)

  • Partitioning/* (5 files) — disciplined ProcessId-suffixed schemas plus a second partition-management schema the OneOff base can't express; same decision as the TPE multi-node files, and several are security-regression tests best left unchurned
  • Disposal-semantics tests (Bug_4874 trio, Bug_4915) — manual disposal ordering is the assertion
  • DI-registration assertion tests (bootstrapping_with_service_collection_extensions, daemon_mode_externally_managed, jasper_fx_mechanics, service_registrations-style Build-only hosts) — StartHostAsync's always-registered main store would pollute the container under test
  • Doc-sample files (BootstrappingExamples, Examples/*, Bug_962) and pure options unit tests (StoreOptionsTests, row_level_security_unit_tests, applying_metrics, …)

Verification

net9.0 local: full CoreTests suite 519 passed / 0 failed (1 pre-existing skip), 21s.

🤖 Generated with Claude Code

https://claude.ai/code/session_01U99pVx6kXwiGmaBUGLv7jB

…esses

Phase-2 harness standardization, CoreTests hotspot (follows #5104/#5105).

Nine inline-host files move onto HostedStoreContext (newly Compile-linked
into CoreTests.csproj): Bugs/Bug_4185, Bugs/Bug_4187, Bugs/Bug_5039,
configuring_marten_with_async_extensions (the sample_registering_async_config
snippet line stays verbatim inside the configureServices lambda),
document_store_diagnostics_tests (8 doc_diag_* literals) and
document_store_usage_tests (6 doc_usage_* literals; literal-schema assertions
rewritten against SchemaName), lazy_ancillary_store_registration,
setting_solo_mode_in_test_support, and working_with_initial_data (deletes the
local MartenHost wrapper; ancillary stores get SchemaName-derived schemas).

Four files move onto / are cleaned up within OneOffConfigurationsContext:
request_count_tracking (also fixes its wrong-order hand-rolled Dispose),
migrate_from_guid_to_int_based_revisions (StoreOptions + SeparateStore over
the shared "migrations" literal), SessionOptionsTests (four leaked
custom-connection stores become tracked SeparateStore calls), and a stray
undisposed store in EventTracingConnectionLifetimeTests gets await using.

Deliberately untouched, by classification: the five Partitioning/* files
(disciplined ProcessId-suffixed schemas plus a second partition-management
schema the OneOff base cannot express - same call as the TPE multi-node
files); disposal-semantics tests (Bug_4874 trio, Bug_4915); DI-registration
assertion tests (bootstrapping_with_service_collection_extensions,
daemon_mode_externally_managed, jasper_fx_mechanics); doc-sample files
(BootstrappingExamples, Examples/*, Bug_962); and pure options unit tests
(StoreOptionsTests, row_level_security_unit_tests, applying_metrics,
extended_progression_gate, constructing_projection_coordinator...).

net9.0: CoreTests 519 passed / 0 failed (1 pre-existing skip).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U99pVx6kXwiGmaBUGLv7jB
@jeremydmiller
jeremydmiller merged commit 625d8cc into master Aug 1, 2026
10 checks passed
@jeremydmiller
jeremydmiller deleted the chore/harness-coretests branch August 1, 2026 15:57
jeremydmiller added a commit that referenced this pull request Aug 1, 2026
…ction (#5107)

Phase-2 harness standardization, MultiTenancyTests hotspot (follows
#5104-#5106). Scope note: unlike the prior migrations, the host/tenancy
construction in these files IS the test subject (master-table vs static vs
per-database strategies), so the hand-built hosts stay. The standardization
win here is the shared plumbing:

- New Marten.Testing/Harness/TenantDatabases: provisions per-tenant databases
  on the test server and hands back connection strings. Uses the
  race-tolerant body from projection_statuses_per_database (check-then-create
  is not atomic across concurrent TFM runs; the loser of the race swallows
  DuplicateDatabase/UniqueViolation). Replaces TEN per-file
  CreateDatabaseIfNotExists copies. DocumentStore_IMartenStorage keeps a thin
  wrapper that adds its schema drops on top.

- The "multi-tenancy" xUnit collection had NINE duplicate
  [CollectionDefinition("multi-tenancy", DisableParallelization = true)]
  declarations, each decorating a test class without enrolling it - only
  projection_statuses_per_database actually joined via [Collection]. One
  definition now lives in MultiTenancyCollection.cs and the nine classes
  join the collection properly. Behavior-neutral today (the assembly disables
  parallelization outright) but now expresses the actual intent.

net9.0: MultiTenancyTests 159/159.


Claude-Session: https://claude.ai/code/session_01U99pVx6kXwiGmaBUGLv7jB

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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