Skip to content

[Test] Simplify SQL Server feature checks to use only compatibility level#38234

Open
ErikEJ wants to merge 2 commits intodotnet:mainfrom
ErikEJ:testenv-fixes
Open

[Test] Simplify SQL Server feature checks to use only compatibility level#38234
ErikEJ wants to merge 2 commits intodotnet:mainfrom
ErikEJ:testenv-fixes

Conversation

@ErikEJ
Copy link
Copy Markdown
Contributor

@ErikEJ ErikEJ commented May 6, 2026

Remove SQL Server version and Azure checks from feature detection in TestEnvironment. Feature support is now determined solely by compatibility level, streamlining logic and reducing complexity. Update SetCompatibilityLevelFromEnvironment to use GetCompatibilityLevel() directly.

Also, FYI: Vector is supported on LocalDB provided the latest CU is installed: see https://erikej.github.io/sqlserver/localdb/2026/03/13/localdb-sqlserver-2025.html

Notice that the compatibility level is read from the master database, and tests usually run against a user database.

  • I've read the guidelines for contributing and seen the walkthrough
  • I've posted a comment on an issue with a detailed description of how I am planning to contribute and got approval from a member of the team
  • The code builds and tests pass locally (also verified by our automated build checks)
  • Commit messages follow this format:
        Summary of the changes
        - Detail 1
        - Detail 2

        Fixes #bugnumber
  • Tests for the changes have been added (for bug fixes / features)
  • Code follows the same patterns and style as existing code in this repo

Remove SQL Server version and Azure checks from feature detection in TestEnvironment. Feature support is now determined solely by compatibility level, streamlining logic and reducing complexity. Update SetCompatibilityLevelFromEnvironment to use GetCompatibilityLevel() directly.

Also, notice that Vector is supported on LocalDB provided the latest CU is installed: see https://erikej.github.io/sqlserver/localdb/2026/03/13/localdb-sqlserver-2025.html
@ErikEJ ErikEJ requested a review from a team as a code owner May 6, 2026 13:20
Copilot AI review requested due to automatic review settings May 6, 2026 13:20
Copy link
Copy Markdown

Copilot AI left a 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 simplifies SQL Server feature detection in the SQL Server functional tests by removing product-version and Azure-specific checks for several feature flags and relying solely on database compatibility level. It also updates test options configuration to set EF’s compatibility level directly from the detected compatibility level.

Changes:

  • Updated multiple TestEnvironment feature flags (temporal cascade delete, UTF-8, JSON path expressions, Functions 2017/2019/2022, JSON type) to check only GetCompatibilityLevel().
  • Changed SetCompatibilityLevelFromEnvironment to use GetCompatibilityLevel() rather than SqlServerMajorVersion * 10.

Copy link
Copy Markdown
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

This makes sense to me; though I'd personally remove all the feature-specific flags (_supportsUtf8, _supportsJsonPathExpressions...) and replace all that stuff with a simple attribute where the tests specifies the compatibility level it wants. I don't really see what all these separate flags and attributes bring us.

@AndriySvyryd what's your view?

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