Skip to content

Add unit tests for FilterValve, ProxyErrorReportValve and SemaphoreValve#976

Open
onkar717 wants to merge 1 commit intoapache:mainfrom
onkar717:test-filter-valve
Open

Add unit tests for FilterValve, ProxyErrorReportValve and SemaphoreValve#976
onkar717 wants to merge 1 commit intoapache:mainfrom
onkar717:test-filter-valve

Conversation

@onkar717
Copy link
Copy Markdown
Contributor

@onkar717 onkar717 commented Apr 1, 2026

Summary

This PR improves test coverage by adding unit tests for several Valve
implementations that currently lack dedicated tests:

  • FilterValve
  • ProxyErrorReportValve
  • SemaphoreValve

Motivation

While reviewing Tomcat valve implementations, these components were
identified as having little or no direct test coverage. Adding tests
helps improve reliability and prevents regressions during future
changes.

Changes

Added new test classes:

  • TestFilterValve
  • TestProxyErrorReportValve
  • TestSemaphoreValve

The tests cover:

  • Basic initialization behavior
  • Request/response processing
  • Error handling paths
  • Concurrency behavior (SemaphoreValve)
  • Configuration edge cases

Testing

All tests pass locally using:

Run all 3 new test classes

JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 ant test \
  -Dtest.name=**/TestProxyErrorReportValve.java,**/TestFilterValve.java,**/TestSemaphoreValve.java

Run with coverage to verify coverage increase

JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 ant test -Dtest.coverage=true \
  -Dtest.haltonfailure=false \
  -Dtest.name=**/valves/Test*.java

No existing tests were modified.

Impact

No functional changes.
Test coverage improvement only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant