Raise test coverage to 98% and drop dead SaveChangesFailed handling - #2
Merged
Merged
Conversation
…pi-v0.1.0 chore: promote public API for v0.1.0
… enumeration caching
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
Benchmark ResultsNo published baseline was found, so these are absolute numbers only. They come from a shared Full results per groupQueryCache.Benchmarks.CacheBenchmarks
QueryCache.Benchmarks.EfMissBreakdownBenchmarks
|
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.
What does this change?
Raises line coverage of the three packages from 87.6% to 98.5% (unit + integration; unit alone 86.4% → 97.0%), mostly in the EF Core invalidation interceptors, which were at 61%. It also removes the
SaveChangesFailedhandling fromQueryCacheInvalidation: it reset state that the nextSavingChangesalways overwrites, so it had no effect. No public API or behavior change. The PR also carries the v0.1.0 public API promotion (PublicAPI.Unshipped.txt→PublicAPI.Shipped.txt) merged intodevelopin #1.New tests:
SaveChanges, synchronous and asynchronous commit and rollback, a failedSaveChangeskeeps cached entries,ToDictionaryCachedAsyncwith a key comparer,FirstCachedAsyncwith a row, a string filter in the query.TransactionScopeinvalidates what another connection cached while the scope was open.SaveChangesreturns only after the invalidation reached the distributed cache, and a value invalidated during its fill is never written there. The fake distributed cache in the tests now writes asynchronously and records its writes, so both can be checked.QueryKeyobject equality andToString;DapperCacheQueryequality, hash code andToString;DynamicParametersfilled withAdd.CA1849is suppressed in the unit test project only: those tests callSaveChanges,CommitandRollbacksynchronously on purpose, to cover the synchronous interceptors.The 5 lines still uncovered are defensive or depend on a race: null context or missing state in the interceptors, other EF expression node types in
TableTags, the LRU update callback, and an invalidation landing exactly during the HybridCache write.Checklist
dotnet build QueryCache.slnx --configuration Releasebuilds clean (warnings are errors)dotnet test --project tests/QueryCache.Tests/QueryCache.Tests.csproj --configuration Releasepasses (79 tests)Test plan
master.SavedChanges, synchronous commit, the synchronous wait on HybridCache invalidation, the HybridCache check that skips storing an invalidated value, theTransactionScopehandler, and two more. The new tests caught all 7.