test: Improve test coverage for ServiceCollectionExtensions and providers - #23
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR significantly enhances test coverage for the MultiLock library by adding comprehensive unit tests for ServiceCollectionExtensions across multiple providers (InMemory, FileSystem, ZooKeeper) and integration tests for FileSystem and ZooKeeper providers. The changes also include a fix for an ambiguous method call in the Redis provider.
Key Changes:
- Added complete test coverage (100%) for ServiceCollectionExtensions of InMemory, FileSystem, and ZooKeeper providers
- Added 10 new FileSystem integration tests covering core scenarios and edge cases
- Added 9 new ZooKeeper integration tests for advanced scenarios including disposal, metadata updates, and multi-group elections
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/MultiLock.Tests/ZooKeeperServiceCollectionExtensionsTests.cs | New test file providing comprehensive unit tests for all ZooKeeper DI extension method overloads |
| tests/MultiLock.Tests/InMemoryServiceCollectionExtensionsTests.cs | New test file with unit tests covering InMemory provider DI registration scenarios |
| tests/MultiLock.Tests/FileSystemServiceCollectionExtensionsTests.cs | New test file testing FileSystem provider DI registration with various configuration options |
| tests/MultiLock.IntegrationTests/ZooKeeperIntegrationTests.cs | Updated existing tests to use await using for proper async disposal and added 9 new integration tests for edge cases |
| tests/MultiLock.IntegrationTests/FileSystemIntegrationTests.cs | New integration test file with 10 tests covering FileSystem provider behavior including auto-directory creation |
| src/Providers/MultiLock.Redis/RedisLeaderElectionProvider.cs | Fixed ambiguous JsonSerializer.Deserialize call by adding explicit cast to string |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #23 +/- ##
==========================================
+ Coverage 70.98% 74.24% +3.25%
==========================================
Files 36 36
Lines 2244 2244
Branches 305 305
==========================================
+ Hits 1593 1666 +73
+ Misses 533 463 -70
+ Partials 118 115 -3
... and 6 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
…ders Add comprehensive unit and integration tests to improve code coverage across multiple providers, increasing overall test count from 283 to 328 tests. Changes: - Add ServiceCollectionExtensions tests for InMemory, FileSystem, and ZooKeeper providers (100% coverage achieved for all extension methods) - Add 10 FileSystem provider integration tests covering lease expiration, health checks, metadata updates, and auto-directory creation - Add 9 ZooKeeper provider integration tests covering edge cases including node reuse, disposal scenarios, metadata updates, and multiple election groups - Fix ambiguous JsonSerializer.Deserialize call in RedisLeaderElectionProvider Coverage improvements: - InMemory ServiceCollectionExtensions: 0% → 100% - FileSystem ServiceCollectionExtensions: 0% → 100% - FileSystem provider: 52.8% → 76% - ZooKeeper ServiceCollectionExtensions: 25% → 100% - ZooKeeper provider: 69.7% → 71.1% All 328 tests passing with proper infrastructure running.
d254ba4 to
ed69f6e
Compare
Description
Add comprehensive unit and integration tests to improve code coverage across multiple providers, increasing overall test count from 283 to 328 tests.
Type of Change
Related Issue
Changes Made
Coverage improvements:
All 328 tests passing with proper infrastructure running.
Testing
Checklist
Labels
Additional Notes