Skip to content

#4617 PR 3: migrate sharded partitioned tests + per_tenant_events_flag guard subset#4623

Merged
jeremydmiller merged 1 commit into
masterfrom
feature/4617-migrate-sharded-and-config-guards
Jun 3, 2026
Merged

#4617 PR 3: migrate sharded partitioned tests + per_tenant_events_flag guard subset#4623
jeremydmiller merged 1 commit into
masterfrom
feature/4617-migrate-sharded-and-config-guards

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Completes the existing-test-file migration leg of #4617 by moving the last 3 files into TenantPartitionedEventsTests. With this PR, every existing partitioned test file from MultiTenancyTests + the CoreTests config-guard subset is now consolidated in the new project.

Sharded migrations (15 tests across 2 files)

New Sharded/ShardedPartitionedFixture.cs — a clone of MultiTenancyTests's ShardedTenancyFixture with a distinct xUnit collection id (\"sharded-tenant-partitioned\" vs the original \"sharded-tenancy\") so the two projects' collection definitions never get mistaken for each other in a shared run. The fixture provisions the 3 physical shard databases (marten_shard_a/b/c), drops the well-known per-test schemas, and exposes the per-shard connection strings — identical setup to the original. Helper CleanMartenObjectsInPublicSchema is public (vs the original's internal visibility) so tests can call it directly when they need to scrub a shard.

File Tests Coverage
Sharded/sharded_tenancy_per_tenant_events.cs 10 Headline sharded per-tenant-partitioning surface + #4598 sequence-provisioning regressions + #4605 IDynamicTenantSource<string> lifecycle
Sharded/sharded_eager_apply_per_tenant_events.cs 1 #4606 eager-apply + per-tenant partition-attach regression

Per-test isolation is preserved (each test still builds its own DocumentStore and wipes shard schemas in InitializeAsync — sharded tests have always been per-test-store; the fixture only provides the shard DBs). Hardcoded tenant names (\"alpha\", \"bravo\", \"india\", \"echo\") stay — they're safe under the fixture's DisableParallelization + per-test wipe pattern.

Config-guard migration (4 tests in 1 file)

Config/per_tenant_events_flag_guards.cs extracts the per_tenant_events_flag nested class from CoreTests/StoreOptionsTests.cs into the new project so every per-tenant-partitioning guard lives in one place alongside its companions (schema_groundwork_for_partitioned_events, etc.):

  • defaults_to_false
  • validate_throws_when_combined_with_rich_append_mode
  • validate_succeeds_with_quick_modes [Theory] over Quick + QuickWithServerTimestamps

The CoreTests slot keeps a one-line breadcrumb pointing to the new location.

Verification

Suite Result
TenantPartitionedEventsTests (full project) net9.0: 55/55 pass (was 40 in PR #4622) — net10.0: 55/55 pass
CoreTests.StoreOptionsTests filtered sweep 27 passed / 1 skipped (clean after the 4 moved out)
MultiTenancyTests build clean — no dangling refs to the 2 deleted sharded files

Migration leg complete

With this PR, all 9 existing partitioned test files from MultiTenancyTests + the CoreTests config-guard subset are now consolidated in TenantPartitionedEventsTests. Subsequent PRs per the #4617 checklist will add the new test categories from sections 3-5 (DCB partitioned coverage, EventProjection, FlatTableProjection, MultiStream RollUpByTenant / AcrossTenants, MasterTableTenancy + SingleServerMultiTenancy gap pins, daemon-in-depth, regression families) plus the string-identity coverage of the optimistic-append feature shipped in #4621.

🤖 Generated with Claude Code

…g guard subset

Completes the existing-test-file migration leg of #4617 by moving the last
3 files into the TenantPartitionedEventsTests project.

## Sharded migrations (15 tests across 2 files)

New `Sharded/ShardedPartitionedFixture.cs` — clone of MultiTenancyTests'
`ShardedTenancyFixture` with a distinct xUnit collection id
(`"sharded-tenant-partitioned"` vs the original `"sharded-tenancy"`) so the
two projects' collection definitions never get mistaken for each other in a
shared run. The fixture provisions the 3 physical shard databases
(`marten_shard_a/b/c`), drops the well-known per-test schemas, and exposes
the per-shard connection strings — identical setup to the original. Helper
`CleanMartenObjectsInPublicSchema` is public (vs the original's internal
visibility) so tests can call it directly when they need to scrub a shard.

Migrated files:
- `Sharded/sharded_tenancy_per_tenant_events.cs` (10 tests) — the headline
  sharded per-tenant partitioning + #4598 sequence-provisioning surface.
- `Sharded/sharded_eager_apply_per_tenant_events.cs` (1 test) — #4606
  eager-apply + per-tenant partition-attach regression.

Per-test isolation is preserved (each test still builds its own
DocumentStore and wipes shard schemas in InitializeAsync — sharded tests
have always been per-test-store; the fixture only provides the shard DBs).
Hardcoded tenant names ("alpha", "bravo", "india", "echo") stay — they're
safe under the fixture's DisableParallelization + per-test wipe pattern.

## Config-guard migration (4 tests in 1 file)

`Config/per_tenant_events_flag_guards.cs` extracts the
`per_tenant_events_flag` nested class from `CoreTests/StoreOptionsTests.cs`
into the new project so every per-tenant-partitioning guard lives in one
place alongside its companions (`schema_groundwork_for_partitioned_events`,
etc.). Tests covered: `defaults_to_false`,
`validate_throws_when_combined_with_rich_append_mode`, +
`validate_succeeds_with_quick_modes` [Theory] over Quick +
QuickWithServerTimestamps. The CoreTests slot keeps a one-line breadcrumb
pointing to the new location.

## Verification

| Suite | Result |
|---|---|
| `TenantPartitionedEventsTests` | **net9.0**: 55/55 (was 40 in PR #4622) — **net10.0**: 55/55 |
| `CoreTests.StoreOptionsTests` | 27 passed / 1 skipped (unchanged after the 4 moved out — the per-tenant guards weren't part of the parent class's test count) |
| `MultiTenancyTests` build | clean — no dangling refs to the 2 deleted sharded files |

## Migration leg complete

With this PR, all 9 existing partitioned test files from MultiTenancyTests +
the CoreTests config-guard subset are now consolidated in
TenantPartitionedEventsTests. Subsequent PRs per the #4617 checklist will
add the new test categories from sections 3-5 (DCB partitioned coverage,
EventProjection, FlatTableProjection, MultiStream RollUpByTenant /
AcrossTenants, MasterTableTenancy + SingleServerMultiTenancy gap pins,
daemon-in-depth, regression families) plus the string-identity coverage
of the optimistic-append feature shipped in #4621.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jeremydmiller jeremydmiller merged commit 9028a44 into master Jun 3, 2026
8 checks passed
@jeremydmiller jeremydmiller deleted the feature/4617-migrate-sharded-and-config-guards branch June 3, 2026 18:13
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