Skip to content
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

Change default compat level to 150 #34319

Merged
merged 1 commit into from
Aug 1, 2024
Merged

Change default compat level to 150 #34319

merged 1 commit into from
Aug 1, 2024

Conversation

ajcvickers
Copy link
Member

Fixes #34316

@ajcvickers ajcvickers requested a review from a team July 30, 2024 15:02
Copy link
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.

OK, I do have an idea for how to make the tests better...

In tests where the SQL varies based on version, we could check what actual version we're running against (on TestEnvironment), and do a conditional AssertSql with the two SQLs; aside from removing the duplication, this would also show very nicely exactly where we have variations across versions...

Ideally, in CI we'd even run the tests twice - once against 2019 and once against 2022. But even if we don't (for now), we'll have 2019 in CI, and 2022 in local runs.

What do you think? Am improving as-is to not block on this, but I think it should be a pretty trivial think to do if you're up for it...

select (from l3 in ss.Set<Level3>()
select l3).Distinct().Skip(1).OrderBy(e => e.Id).FirstOrDefault().Name);

AssertSql(
Copy link
Member

Choose a reason for hiding this comment

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

If we do keep the test suite duplication, one idea to make this lighter is to not do SQL assertions except for those tests where there's a difference

@ajcvickers
Copy link
Member Author

I think we should discuss the testing some more. There are test infrastructure aspects to this. For example, we can't easily switch back and forth in a normal fixture, because the compat level is a singleton option. Also, I think there is value in asserting the SQL in both places, to catch regressions where we switch to using a 2022 feature in the 2019 cases, for example.

The main thing is that we need better support for this in the test infrastructure. And we should consider both which variations add the most value to run as well as reducing the duplication in test overrides and baselines.

@roji
Copy link
Member

roji commented Aug 1, 2024

And we should consider both which variations add the most value to run as well as reducing the duplication in test overrides and baselines

I agree, I'm just saying that we can get full coverage for both SQL variants by running builds in CI (against different SQL Server versions), rather than attempting to have both variants handled inside the same test run, via different test classes. This also would provide better cover in that we'd actually test against 2019 and 2022, as opposed to running the two SQL variants against 2022. In he PG provide, for example, we run a CI matrix against all supported versions of PG, with slight variations in SQL generation which are handled this way.

Of course, doing this fully assumes we run both 2019 and 2022 configs in CI, which we still don't have (but I think we should go in this direction).

For example, we can't easily switch back and forth in a normal fixture, because the compat level is a singleton option.

I don't think that's needed in what I'm proposing: the (only) test suite would check which database it's running against (by looking at TestEnvironment, which checks the actual database version), and then configure only that version in UseSqlServer(). This way each CI config (of which there would be two) would only ever execute a single SQL version against its intended actual database version.

Having said all that, I think it's perfectly fine to merge this PR as-is and clean up later!

@ajcvickers ajcvickers merged commit 144e170 into main Aug 1, 2024
7 checks passed
@ajcvickers ajcvickers deleted the NewButNotThatNew branch August 1, 2024 11:01
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.

Change default SQL Server compat level to 150 (SQL Server 2019)
2 participants