Skip to content

Add Database/Schema support to SQL Server and PostgreSQL persisters - #5862

Merged
johnsimons merged 2 commits into
masterfrom
john/cloud_tests
Sep 11, 2026
Merged

Add Database/Schema support to SQL Server and PostgreSQL persisters#5862
johnsimons merged 2 commits into
masterfrom
john/cloud_tests

Conversation

@johnsimons

Copy link
Copy Markdown
Member

Each test now takes its own schema in one shared database rather than its own database, which exercises the same Database/Schema setting offered to customers. Migrations are stamped with the configured schema at generation time via a custom IMigrationsSqlGenerator, raw SQL in the dialects is qualified using the schema-aware table name helper, and the migrators require the schema to exist rather than silently creating it. SchemaName validates the value before it reaches any DDL interpolation.

@johnsimons johnsimons self-assigned this Sep 8, 2026
@johnsimons
johnsimons removed this pull request from stack #5864 September 9, 2026 01:34
@johnsimons
johnsimons added this pull request to stack #5866 September 9, 2026 03:12
class SchemaMustExistTests
{
[Test]
public async Task Migration_fails_when_the_configured_schema_does_not_exist()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this test be written in the shared folder instead of duplicated?

Each test now takes its own schema in one shared database rather than its own database, which exercises the same Database/Schema setting offered to customers. Migrations are stamped with the configured schema at generation time via a custom IMigrationsSqlGenerator, raw SQL in the dialects is qualified using the schema-aware table name helper, and the migrators require the schema to exist rather than silently creating it. SchemaName validates the value before it reaches any DDL interpolation.
…rios

Tests that run more than one scenario call CustomizeSettings multiple times, creating a new schema each time, but the old single-field approach only tracked the most recent. When Cleanup ran, earlier schemas were left behind in the shared database.

Switching to ConcurrentBag accumulates every schema and body storage path created across all scenarios, so Cleanup drains and removes all of them. The one-shot cleanupStarted guard is also removed, since iterating the bag is already idempotent.

Schema setup and teardown on SQL Server also now retries on deadlock (error 1205), which occurs when many tests concurrently hit the system catalogs with DDL. DropSchema additionally switches to READ UNCOMMITTED to avoid taking shared locks on catalog reads that were themselves entering deadlocks.
@johnsimons
johnsimons merged commit c4ad657 into master Sep 11, 2026
69 of 70 checks passed
@johnsimons
johnsimons deleted the john/cloud_tests branch September 11, 2026 07:07
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.

4 participants