Improve test coverage for AccessLogValve and PersistentValve#979
Open
onkar717 wants to merge 1 commit intoapache:mainfrom
Open
Improve test coverage for AccessLogValve and PersistentValve#979onkar717 wants to merge 1 commit intoapache:mainfrom
onkar717 wants to merge 1 commit intoapache:mainfrom
Conversation
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
This PR improves test coverage for AccessLogValve and PersistentValve by
adding tests for currently uncovered functionality related to file I/O,
log rotation, configuration handling and request filtering.
Motivation
While reviewing valve test coverage, AccessLogValve-specific logic such as
file writing, rotation, encoding handling and maxDays cleanup was found to
have little or no direct coverage. Similarly, several configuration and
filter-related paths in PersistentValve were not exercised.
This PR focuses on improving coverage for these implementation-specific
code paths.
Changes
AccessLogValve
Added new test class:
TestAccessLogValveFile
Coverage improvements include:
PersistentValve
Extended existing:
TestPersistentValve
Added coverage for:
Testing
All tests pass locally:
ant clean test
Targeted testing also performed with:
ant test -Dtest.name=org.apache.catalina.valves.*
Coverage verified using:
ant test -Dtest.coverage=true
Coverage Notes
Some AccessLogValve error handling paths (for example OS-level file
deletion failures or IOException during file creation) are difficult
to reliably reproduce in unit tests.
This PR aims to cover all realistically testable execution paths while
improving overall instruction coverage significantly.
Impact
No functional changes.
Test coverage improvement only.
Future Work
Additional opportunities may exist to improve coverage in other Valve
implementations and configuration parsing components.
Checklist