-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[rc2] Fix tests for Azure SQL and SQL Server 2025 #36631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes tests for Azure SQL and SQL Server 2025 by updating test utilities and fixtures to properly handle compatibility level requirements and provider selection.
Key Changes
- Replaces hardcoded connection string configuration with runtime provider selection
- Updates compatibility level handling to use appropriate provider (UseAzureSql vs UseSqlServer)
- Adds compatibility level checks for feature support detection
- Fixes test baselines for SQL Server 2025's new JSON type behavior
Reviewed Changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
TestEnvironment.cs | Adds compatibility level detection and renames IsSqlAzure to IsAzureSql |
SqlServerTestStore.cs | Updates provider selection based on Azure SQL detection |
Various test fixture files | Updates to use appropriate provider based on environment |
Query test files | Updates SQL baselines for JSON type changes in SQL Server 2025 |
test/EFCore.SqlServer.FunctionalTests/TestUtilities/TestEnvironment.cs
Outdated
Show resolved
Hide resolved
7b768fd
to
d17e25a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @AndriySvyryd. We really should start testing on new SQL Server in CI soon to catch this kind of thing earlier.
return TestEnvironment.SqlServerMajorVersion < 17 | ||
? options | ||
: TestEnvironment.IsAzureSql | ||
? options.UseAzureSql(b => b.UseCompatibilityLevel(170)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this was needed because UseSqlServer caused us to send JSON_VALUE with the RETURNING clause, which currently still isn't supported by Azure SQL? Just asking (no problem with the change)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this doesn't change the behavior, it's just using the correct API for Azure
return TestEnvironment.SqlServerMajorVersion < 17 | ||
? options | ||
: TestEnvironment.IsAzureSql | ||
? options.UseAzureSql(b => b.UseCompatibilityLevel(170)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also since this is done in many places we may want to have a common utility
5e2d8d9
to
f760e2b
Compare
@artl93 Test-only change