Skip to content

Make non-shared query test store names unique per test class - #39551

Merged
AndriySvyryd merged 1 commit into
dotnet:mainfrom
ajcvickers:fix-nonshared-store-name-collision
Nov 13, 2026
Merged

AndriySvyryd merged 1 commit into
dotnet:mainfrom
ajcvickers:fix-nonshared-store-name-collision

Conversation

@ajcvickers

Copy link
Copy Markdown
Contributor

Non-shared query tests used Fixture.StoreName + "_NonShared" as the database name. Many fixtures share a StoreName (e.g. "ManyToManyQueryTest"), and each test class gets its own fixture instance, so classes running in parallel cleaned, recreated and seeded the same database. This caused intermittent failures such as "no such table: ManyM_DB", leftover seed rows (8 instead of 2) and unexpected identity values.

Include the test class name in the store name so each class has its own database.

Non-shared query tests used Fixture.StoreName + "_NonShared" as the
database name. Many fixtures share a StoreName (e.g. "ManyToManyQueryTest"),
and each test class gets its own fixture instance, so classes running in
parallel cleaned, recreated and seeded the same database. This caused
intermittent failures such as "no such table: ManyM_DB", leftover seed
rows (8 instead of 2) and unexpected identity values.

Include the test class name in the store name so each class has its own
database.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@ajcvickers
ajcvickers requested a review from a team as a code owner November 6, 2026 11:45
Copilot AI balanced review requested due to automatic review settings November 6, 2026 11:45

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues are reported for the change that isolates non-shared query test databases by test class.

No open issues 🎉

What changed in this PR

This PR isolates non-shared query test databases by test class, preventing parallel classes with the same fixture store name from interfering with each other.

Changes:

  • Adds the runtime test class name to NonSharedStoreName, preserving the fixture name and _NonShared suffix.
File Description
test/​EFCore.Specification.Tests/​Query/​QueryTestBase.cs Includes the test class name in non-shared store names to avoid cross-class database collisions.

Review effort: Balanced

@AndriySvyryd AndriySvyryd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your contribution!

@AndriySvyryd
AndriySvyryd merged commit 9b0ede7 into dotnet:main Nov 13, 2026
20 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants