onkar717 opened a new pull request, #979: URL: https://github.com/apache/tomcat/pull/979
## 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: - File log writing behavior - Log rotation logic - Rotation with custom filenames - renameOnRotate behavior - maxDays log cleanup - Buffered vs unbuffered writes - File existence checks - Encoding configuration - Property getters/setters - Lifecycle start/stop behavior ### PersistentValve Extended existing: TestPersistentValve Added coverage for: - Request filtering behavior - Filter configuration handling - Session stale detection logic - Semaphore configuration properties - Filtered request invocation path - Null context handling ## 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 - [x] Tests added - [x] Existing tests pass - [x] No functional changes - [x] ASF license headers added - [x] Clean build (ant clean test) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
