Repository navigation
test: start database containers only for provider tests - #52
Merged
Merged
Conversation
xUnit v3 starts assembly fixtures on every run, so since #50 even a filtered unit-only run started the SQL Server and PostgreSQL containers and required Docker. Share each container through a collection fixture instead: it still starts once per provider, but only when that provider's tests run. Move the unique table name helper to the fixtures, so the four test classes no longer keep their own copies.
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.
Since #50 the SQL Server and PostgreSQL fixtures were xUnit v3 assembly fixtures. xUnit v3 starts those on every run, so even a filtered unit-only run (for example
--filter-class "*.StorageWrapperTests") started both containers and failed without Docker.Change
SqlServerCollection/PostgreSqlCollection,[Collection(...)]on the repository and end-to-end test classes). There is still one container per provider, but it starts only when that provider's tests run.NewTableName()to the fixtures as a public static helper, replacing four private copies.Verification
dotnet build -c Release: 0 warnings, 0 errors.dotnet test --no-build -c Release --filter-class "*.StorageWrapperTests": 19/19 in 0.9s, no containers started.dotnet test --no-build -c Release: 156/156 passed.