[
https://issues.apache.org/jira/browse/KAFKA-21446?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Harsh Vasava updated KAFKA-21446:
---------------------------------
Description:
Kafka Connect runtime declares Apache HttpClient 4.5.14 as a test dependency.
Its usages are confined to {{ConnectRestServerTest}} and
{{{}RestForwardingIntegrationTest{}}}, while Jetty Client is already directly
declared by the module through {{implementation}} and
{{{}testFixturesImplementation{}}}.
I propose replacing the Apache HttpClient usages in these classes with direct
Jetty Client requests, preserving existing assertions and coverage,
particularly OPTIONS/CORS checks and the six HTTP/HTTPS/dual-listener
forwarding scenarios. This allows removal of the unused test dependency, shared
version and library definitions, and the two {{org.apache.http}} import-control
entries.
The change is implemented on a branch based on upstream/trunk and validated at
commit {{{}7d3c267e{}}}. The tests continue to send external requests directly
to the REST endpoints without using the production {{RestClient}} wrapper.
Branch:
[https://github.com/Harsh-99999/kafka/tree/connect-rest-tests-jetty-client]
Validation:
* All 15 {{ConnectRestServerTest}} tests passed.
* All 6 {{RestForwardingIntegrationTest}} scenarios passed.
* The build including {{checkstyleTest}} and {{spotlessCheck}} succeeded.
* Gradle {{dependencyInsight}} found no {{org.apache.httpcomponents}}
dependencies on {{{}testRuntimeClasspath{}}}.
Tests and checks:
{code:bash}
./gradlew :connect:runtime:test --tests
org.apache.kafka.connect.runtime.rest.ConnectRestServerTest --tests
org.apache.kafka.connect.integration.RestForwardingIntegrationTest
:connect:runtime:checkstyleTest :connect:runtime:spotlessCheck
{code}
Dependency verification:
{code:bash}
./gradlew :connect:runtime:dependencyInsight --dependency
org.apache.httpcomponents --configuration testRuntimeClasspath
{code}
These checks used Java 21 and Gradle 9.8.2 on Windows. The filtered {{test}}
task ran both classes, including the integration-tagged forwarding scenarios.
This is a test-infrastructure cleanup; no production source, public API,
configuration, or protocol changes are proposed.
Does this cleanup look worthwhile? Is there a reason to retain Apache
HttpClient as a separate HTTP implementation in these tests?
was:
Kafka Connect runtime declares Apache HttpClient 4.5.14 as a test dependency.
Its usages are confined to {{ConnectRestServerTest}} and
{{{}RestForwardingIntegrationTest{}}}, while Jetty Client is already directly
declared by the module through {{implementation}} and
{{{}testFixturesImplementation{}}}.
I propose replacing the Apache HttpClient usages in these classes with direct
Jetty Client requests, preserving existing assertions and coverage,
particularly OPTIONS/CORS checks and the six HTTP/HTTPS/dual-listener
forwarding scenarios. This allows removal of the unused test dependency, shared
version and library definitions, and the two {{org.apache.http}} import-control
entries.
The change is implemented on a branch based on upstream/trunk and validated at
commit {{{}7d3c267e{}}}. The tests continue to send external requests directly
to the REST endpoints without using the production {{RestClient}} wrapper.
Branch:
[https://github.com/Harsh-99999/kafka/tree/connect-rest-tests-jetty-client]
Validation:
* All 15 {{ConnectRestServerTest}} tests passed.
* All 6 {{RestForwardingIntegrationTest}} scenarios passed.
* The build including {{checkstyleTest}} and {{spotlessCheck}} succeeded.
* Gradle {{dependencyInsight}} found no {{org.apache.httpcomponents}}
dependencies on {{{}testRuntimeClasspath{}}}.
Tests and checks:
{code:bash}
./gradlew :connect:runtime:test --tests
org.apache.kafka.connect.runtime.rest.ConnectRestServerTest --tests
org.apache.kafka.connect.integration.RestForwardingIntegrationTest
:connect:runtime:checkstyleTest :connect:runtime:spotlessCheck
{code}
Dependency verification:
{code:bash}
./gradlew :connect:runtime:dependencyInsight --dependency
org.apache.httpcomponents --configuration testRuntimeClasspath
{code}
These checks used Java 21 and Gradle 9.8.2 on Windows. The filtered {{test}}
task ran both classes, including the integration-tagged forwarding scenarios.
This is a test-infrastructure cleanup; no production source, public API,
configuration, or protocol changes are proposed.
Does this cleanup look worthwhile? Is there a reason to retain Apache
HttpClient as a separate HTTP implementation in these tests? I would like to
contribute the change and can open a PR if the approach makes sense.
> Replace Apache HttpClient with Jetty Client in Connect runtime tests
> --------------------------------------------------------------------
>
> Key: KAFKA-21446
> URL: https://issues.apache.org/jira/browse/KAFKA-21446
> Project: Kafka
> Issue Type: Improvement
> Components: connect
> Reporter: Harsh Vasava
> Assignee: Harsh Vasava
> Priority: Minor
>
> Kafka Connect runtime declares Apache HttpClient 4.5.14 as a test dependency.
> Its usages are confined to {{ConnectRestServerTest}} and
> {{{}RestForwardingIntegrationTest{}}}, while Jetty Client is already directly
> declared by the module through {{implementation}} and
> {{{}testFixturesImplementation{}}}.
> I propose replacing the Apache HttpClient usages in these classes with direct
> Jetty Client requests, preserving existing assertions and coverage,
> particularly OPTIONS/CORS checks and the six HTTP/HTTPS/dual-listener
> forwarding scenarios. This allows removal of the unused test dependency,
> shared version and library definitions, and the two {{org.apache.http}}
> import-control entries.
> The change is implemented on a branch based on upstream/trunk and validated
> at commit {{{}7d3c267e{}}}. The tests continue to send external requests
> directly to the REST endpoints without using the production {{RestClient}}
> wrapper.
> Branch:
> [https://github.com/Harsh-99999/kafka/tree/connect-rest-tests-jetty-client]
> Validation:
> * All 15 {{ConnectRestServerTest}} tests passed.
> * All 6 {{RestForwardingIntegrationTest}} scenarios passed.
> * The build including {{checkstyleTest}} and {{spotlessCheck}} succeeded.
> * Gradle {{dependencyInsight}} found no {{org.apache.httpcomponents}}
> dependencies on {{{}testRuntimeClasspath{}}}.
> Tests and checks:
> {code:bash}
> ./gradlew :connect:runtime:test --tests
> org.apache.kafka.connect.runtime.rest.ConnectRestServerTest --tests
> org.apache.kafka.connect.integration.RestForwardingIntegrationTest
> :connect:runtime:checkstyleTest :connect:runtime:spotlessCheck
> {code}
> Dependency verification:
> {code:bash}
> ./gradlew :connect:runtime:dependencyInsight --dependency
> org.apache.httpcomponents --configuration testRuntimeClasspath
> {code}
> These checks used Java 21 and Gradle 9.8.2 on Windows. The filtered {{test}}
> task ran both classes, including the integration-tagged forwarding scenarios.
> This is a test-infrastructure cleanup; no production source, public API,
> configuration, or protocol changes are proposed.
> Does this cleanup look worthwhile? Is there a reason to retain Apache
> HttpClient as a separate HTTP implementation in these tests?
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)