🧪📦🔧 Improve test coverage across multiple packages#432
Merged
Conversation
- Add tests for event, filter, handler, client, watcher, pvcmonitor packages - Improve coverage for upgrader, state, startup, telemetry, util packages - Refactor watcher package with WatchInterface and WatcherFactory for better testability - Add mock types for testing k8s watch operations - Fix deprecated workqueue.New and toolsWatch.NewRetryWatcher usage - Update health.NewHealthServer to accept config.HealthCheck struct Coverage improvements: - event: 0% → 100% - filter: 0% → 91.4% - handler: 0% → 94.8% - client: 0% → 78.3% - watcher: 25% → 44.7% - pvcmonitor: 0% → 31.6% - upgrader: 3.6% → 68.8% - state: 80% → 91.4% - startup: 76.9% → 84.6% - telemetry: 87% → 91.3% - util: 79.6% → 87%
Use atomic counter and mutex for thread-safe test assertions
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.
Summary
WatchInterfaceandWatcherFactoryfor better testabilityworkqueue.New→NewTyped,NewRetryWatcher→NewRetryWatcherWithContext)Coverage Improvements
Changes
client_test.go,event_test.go,filter_test.go,handler_test.go,pvcmonitor_test.go,watcher_test.gowatcher/watcher.go,watcher/start.go,upgrader/upgrader.go,client/client.goWatchInterfaceandWatcherFactoryinterfaces for testable k8s watch operationsTesting
All tests pass:
go test ./...