Share tenant-database provisioning and dedupe the multi-tenancy collection - #5107
Merged
Conversation
…ction 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. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U99pVx6kXwiGmaBUGLv7jB
This was referenced Aug 1, 2026
This was referenced Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase-2 test-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 deliberately stay. The standardization win is the shared plumbing:
New
Marten.Testing/Harness/TenantDatabasesProvisions per-tenant databases on the test server and hands back connection strings. Replaces ten per-file
CreateDatabaseIfNotExistscopies. The shared body is the best of the ten — the race-tolerant variant fromprojection_statuses_per_database(check-then-create isn't atomic across concurrent TFM runs, so the loser of the race swallowsDuplicateDatabase/UniqueViolation).DocumentStore_IMartenStorage_implementationkeeps a thin wrapper adding its schema drops on top.multi-tenancycollection dedupThere were nine duplicate
[CollectionDefinition("multi-tenancy", DisableParallelization = true)]declarations, each decorating a test class without enrolling it — onlyprojection_statuses_per_databaseactually joined via[Collection]. One definition now lives inMultiTenancyCollection.csand the nine classes join the collection properly. Behavior-neutral today (the assembly disables parallelization outright), but the declaration now matches the intent.Verification
net9.0 local: full MultiTenancyTests suite 159/159, 24s.
🤖 Generated with Claude Code
https://claude.ai/code/session_01U99pVx6kXwiGmaBUGLv7jB