Merge AdHoc query tests into shared test bases (ManyToMany, ComplexType, Json) - #38756
Merge AdHoc query tests into shared test bases (ManyToMany, ComplexType, Json)#38756AndriySvyryd with Copilot wants to merge 6 commits into
Conversation
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
…ar SqlServer verified) Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
…st classes Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR continues the effort to consolidate “AdHoc” (non-shared model) query tests into the shared *QueryTestBase<TFixture> hierarchies, reducing duplicated non-shared test infrastructure and keeping area-related tests together (Many-to-many, Complex types, JSON).
Changes:
- Moved non-shared Many-to-many tests into
ManyToManyQueryTestBaseand added/adjusted SQL Server/TPC/TPT overrides; removedAdHocManyToMany*test types. - Moved non-shared ComplexType tests into shared spec/relational bases and provider tests (SqlServer/Sqlite/Cosmos); removed
AdHocComplexType*types. - Moved non-shared JSON relational tests into
JsonQueryRelationalTestBaseand adjusted provider seeding/fixtures; removedAdHocJson*types.
Reviewed changes
Copilot reviewed 31 out of 33 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs | Adds SQL Server baselines for newly inlined non-shared Many-to-many tests. |
| test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerFixture.cs | Narrows log category filtering for JSON SQL Server tests. |
| test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTManyToManyQuerySqlServerTest.cs | Adds TPT SQL baselines for newly inlined non-shared Many-to-many tests. |
| test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCManyToManyQuerySqlServerTest.cs | Adds TPC SQL baselines for newly inlined non-shared Many-to-many tests. |
| test/EFCore.SqlServer.FunctionalTests/Query/ComplexTypeQuerySqlServerTest.cs | Inlines non-shared ComplexType SQL Server assertions/resources into the shared test class. |
| test/EFCore.SqlServer.FunctionalTests/Query/AdHocManyToManyQuerySqlServerTest.cs | Removes redundant AdHoc SQL Server Many-to-many test class. |
| test/EFCore.SqlServer.FunctionalTests/Query/AdHocJsonQuerySqlServerTest.cs | Removes redundant AdHoc SQL Server JSON (nvarchar) test class. |
| test/EFCore.SqlServer.FunctionalTests/Query/AdHocJsonQuerySqlServerJsonTypeTest.cs | Removes redundant AdHoc SQL Server JSON-type test class. |
| test/EFCore.SqlServer.FunctionalTests/Query/AdHocComplexTypeQuerySqlServerTest.cs | Removes redundant AdHoc SQL Server ComplexType test class. |
| test/EFCore.Sqlite.FunctionalTests/Query/JsonQuerySqliteTest.cs | Inlines non-shared JSON seeding/behavior into the shared Sqlite JSON test class. |
| test/EFCore.Sqlite.FunctionalTests/Query/ComplexTypeQuerySqliteTest.cs | Inlines non-shared ComplexType SQL assertions into the shared Sqlite ComplexType test class. |
| test/EFCore.Sqlite.FunctionalTests/Query/AdHocManyToManyQuerySqliteTest.cs | Removes redundant AdHoc Sqlite Many-to-many test class. |
| test/EFCore.Sqlite.FunctionalTests/Query/AdHocJsonQuerySqliteTest.cs | Removes redundant AdHoc Sqlite JSON test class. |
| test/EFCore.Sqlite.FunctionalTests/Query/AdHocComplexTypeQuerySqliteTest.cs | Removes redundant AdHoc Sqlite ComplexType test class. |
| test/EFCore.Specification.Tests/Query/ManyToManyQueryTestBase.cs | Hosts the non-shared Many-to-many tests/resources inside the shared spec base. |
| test/EFCore.Specification.Tests/Query/ComplexTypeQueryTestBase.cs | Hosts the non-shared ComplexType tests/resources inside the shared spec base. |
| test/EFCore.Specification.Tests/Query/AdHocManyToManyQueryTestBase.cs | Removes redundant AdHoc spec base for Many-to-many. |
| test/EFCore.Specification.Tests/Query/AdHocComplexTypeQueryTestBase.cs | Removes redundant AdHoc spec base for ComplexType. |
| test/EFCore.Relational.Specification.Tests/Query/JsonQueryRelationalTestBase.cs | Hosts the non-shared JSON relational tests/resources inside the shared relational base. |
| test/EFCore.Relational.Specification.Tests/Query/ComplexTypeQueryRelationalTestBase.cs | Hosts the non-shared ComplexType relational tests/resources inside the shared relational base. |
| test/EFCore.Relational.Specification.Tests/Query/AdHocManyToManyQueryRelationalTestBase.cs | Removes redundant AdHoc relational base for Many-to-many. |
| test/EFCore.Relational.Specification.Tests/Query/AdHocJsonQueryRelationalTestBase.cs | Removes redundant AdHoc relational base for JSON. |
| test/EFCore.Relational.Specification.Tests/Query/AdHocComplexTypeQueryRelationalTestBase.cs | Removes redundant AdHoc relational base for ComplexType. |
| test/EFCore.InMemory.FunctionalTests/Query/AdHocManyToManyQueryInMemoryTest.cs | Removes redundant AdHoc InMemory Many-to-many test class. |
| test/EFCore.Cosmos.FunctionalTests/Query/ComplexTypeQueryCosmosTest.cs | Inlines non-shared ComplexType Cosmos assertions/resources into the shared Cosmos test class. |
| test/EFCore.Cosmos.FunctionalTests/Query/AdHocComplexTypeQueryCosmosTest.cs | Removes redundant AdHoc Cosmos ComplexType test class. |
| var contextFactory = await InitializeNonSharedTest<Context35025>(); | ||
| using var context = contextFactory.CreateDbContext(); | ||
|
|
||
| var count = await context.TpcBases.ToListAsync(); |
| """); | ||
| } | ||
|
|
||
| public override async Task Can_save_batch_swapping_alternate_key_values_on_complex_type_property() |
There was a problem hiding this comment.
@copilot This test is currently failing, probably due to incorrect database initialization
Make sure to run all Cosmos dunctional tests
There was a problem hiding this comment.
Fixed in ad6759b. ComplexTypeToJsonPropertyQueryCosmosTest now passes locally (163 total, 0 failed), and the full Cosmos run had no ComplexType failures; remaining full-run failures were unrelated vector emulator setup failures.
| var contextFactory = await InitializeNonSharedTest<Context35025>(); | ||
| using var context = contextFactory.CreateDbContext(); | ||
|
|
||
| var count = await context.TpcBases.ToListAsync(); |
|
|
||
| builder.Log(CoreEventId.StringEnumValueInJson); | ||
| } | ||
|
|
There was a problem hiding this comment.
@copilot Json_collection_index_in_projection_nested_project_scalar is failing, probably due to incorrect test store initialization.
Make sure all tests assert SQL baseline and run all SqlServer functional tests
There was a problem hiding this comment.
Verified in ad6759b. The targeted Json_collection_index_in_projection_nested_project_scalar tests pass for both SqlServer JSON variants, and the full SqlServer run had no JSON failures; remaining full-run failures were unrelated FullTextSearch/SqlAzure environment failures.
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 34 out of 36 changed files in this pull request and generated no new comments.
Suppressed comments (1)
test/EFCore.Sqlite.FunctionalTests/Query/JsonQuerySqliteTest.cs:502
- SQLite seeding SQL uses square-bracket quoting for the table name (
INSERT INTO [Entities]) while the rest of this method uses SQLite-style double quotes ("Entities"). Keeping quoting consistent makes these raw SQL blocks easier to read/copy and avoids confusion when porting between providers.
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 34 out of 36 changed files in this pull request and generated no new comments.
Suppressed comments (1)
test/EFCore.Relational.Specification.Tests/Query/ComplexTypeQueryRelationalTestBase.cs:132
- In this async test method, the DbContext is disposed with a synchronous
using. Since DbContext implements IAsyncDisposable and this file already usesawait usingin similar non-shared tests, preferawait usinghere as well to ensure async disposal paths are used consistently (can matter for provider-specific async cleanup).
var contextFactory = await InitializeNonSharedTest<Context35025>();
using var context = contextFactory.CreateDbContext();
Continues #37681
Part of #33526
Consolidates the
AdHoc<Name>QueryTestBasefamilies (which derive fromNonSharedModelTestBase) into their shared<Name>QueryTestBase<TFixture>counterparts, eliminating duplicated non-shared-model test infrastructure.Non-shared tests now live under a
#region Non-shared test resourcesin the shared base and rely on theInitializeNonSharedTest/NonSharedStoreName/ListLoggerFactorysupport already provided byQueryTestBase.Changes
ManyToManyQueryTestBase+ SqlServer/TPC/TPT provider overrides; AdHoc files removed.AssertSql.JsonQueryTestBase) and relational (JsonQueryRelationalTestBase) bases, carrying over theJsonColumnTypeabstraction. The nvarchar variant (JsonQuerySqlServerTest) and json-type variant (JsonQueryJsonTypeSqlServerTest,[ConditionalClass]gated onIsJsonTypeSupported) each receive the full override set with their own baselines, since they now both derive from the relational base rather than a shared SqlServer base.