Don't use migrations for all tests, add test runner parallelism - #5667
Open
rbev wants to merge 2 commits into
Open
Don't use migrations for all tests, add test runner parallelism#5667rbev wants to merge 2 commits into
rbev wants to merge 2 commits into
Conversation
johnsimons
reviewed
Jul 30, 2026
Comment on lines
+11
to
+18
| public async Task ApplyMigrations_runs_successfully() | ||
| { | ||
| var ctx = new PersistenceTestsContext(); | ||
| var hostBuilder = new HostApplicationBuilder(); | ||
| await ctx.Setup(hostBuilder); | ||
| var host = hostBuilder.Build(); | ||
| await host.Services.GetRequiredService<IDatabaseMigrator>().ApplyMigrations(); | ||
| } |
Member
There was a problem hiding this comment.
But this runs the migrations in isolation, so yes we are testing that the migration code is working but not necessarily that when utilized in the tests is working
Contributor
Author
There was a problem hiding this comment.
I've had second thoughts about not running the migrations in every test, if there's any custom sql run during the migrations we will end up with a different database (e.g. creating full text indexes)
johnsimons
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces improvements to the test infrastructure for the persistence layer, focusing on parallelization, database setup, and migration testing. The main changes include enabling parallel test execution, adjusting database initialization logic for test contexts, and adding a new test to verify that database migrations can be applied successfully.
Test infrastructure improvements:
SqlServerandPostgreSqltest projects by addingNUnitSettings.csfiles.PersistenceTestsContextfor bothSqlServerandPostgreSqlto useEnsureCreatedAsyncinstead ofMigrateAsync, simplifying test database setup. [1] [2]Database migration testing:
DbMigrationsTestswith a test to verify thatIDatabaseMigrator.ApplyMigrations()runs successfully, ensuring migrations are tested independently.Code organization:
EFCoreExtensionMethodTests.csto match the rest of the test suite for consistency.