Improve test coverage for checker, vipconfig, and main packages#381
Draft
pashagolub wants to merge 6 commits into
Draft
Improve test coverage for checker, vipconfig, and main packages#381pashagolub wants to merge 6 commits into
pashagolub wants to merge 6 commits into
Conversation
…, and vipconfig packages - Add tests for getMask IPv4/IPv6 CIDR mask calculation - Add tests for applyLoop and SyncStates with mock configurer - Test IPv6 address support and different hosting types - Add timeout test for Patroni checker - Add NewConfig public API test with os.Args integration - Improve error path coverage in ipmanager and vipconfig - Current coverage: 51.0% (up from 46.4%) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add TestGetMask IPv4 out-of-range tests - Add TestApplyLoop error scenarios (configure failure, query fails) - Add TestApplyLoop_NoChangeNeeded test - Add TestApplyLoop_DeconfigureWhenNeeded test - Add TestGetNetIface_Success test with fallback logic - Achieve 100% coverage for getMask, applyLoop, and SyncStates - Overall coverage: 52.0% (up from 51.0%) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add TestVersionFlagHandling to test version flag detection logic - Add TestVersionFlagOutput to verify version output format - Test multiple arg combinations for version flag presence - Provides foundation for testing CLI argument handling Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
a5baf04 to
66bb1e9
Compare
The test was expecting an error during Hetzner configurer creation, but the function doesn't validate config at initialization time. The error now correctly occurs from the loopback interface validation.
Added early return after error check to prevent calling err.Error() on a nil error value, which caused a panic in GHA.
The test was using 'lo' (loopback), which exists and is up on CI systems. Changed to a guaranteed non-existent interface name to ensure the test always fails with 'failed to get interface' error as intended.
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.
Motivation
Systematic test coverage improvement across critical packages to strengthen the test suite and establish patterns for reaching the 85% coverage target. Added comprehensive unit tests for edge cases, error paths, and CLI-level logic.
Changes
Coverage Results
Technical Approach
Remaining Work
Primary gap is ipmanager package (18.7% coverage). Future improvements should focus on:
Closes #380