oscerd opened a new pull request, #1868:
URL: https://github.com/apache/camel-kafka-connector/pull/1868
Fixes #743
Fixes #744
Fixes #745
### Change
This adds the `tests/itests-ftp` module, with one source and one sink
integration test per protocol for the `ftp`, `ftps` and `sftp` Kamelet
connectors. The tests use the embedded servers from `camel-test-infra-ftp`
(4.22.0).
- **Source tests** move a file into the polled directory. They check that
the record value equals the file content, and that the `CamelHeader.file`
header carries the file name.
- **Sink tests** send three records with a `CamelHeader.file` Kafka header.
They check the files' names and contents on the server, using Awaitility with
an explicit `atMost` (no `Thread.sleep`).
- **FTPS** runs in explicit mode, since the ftps Kamelets have no `implicit`
option. The server certificate is validated through configuration only, with
`camel.ssl.*` and `camel.component.ftps.useGlobalSslContextParameters=true`.
The keystore comes from the camel-test-infra-ftp jar, so a future Camel bump
also brings its certificate.
- **SFTP** verifies the server host key, with `strictHostKeyChecking=yes`
and a `known_hosts` file built from the running server's key
(`camel.component.sftp.knownHostsFile`).
- The source factory converts the record value with the
`CamelTypeConverterTransform` SMT. The test assertions then don't depend on how
the ftp/ftps sources hand over the file content; that is fixed separately in
#1852.
### Verification
- `./mvnw -pl tests/itests-ftp -DskipIntegrationTests=false
-Dfailsafe.rerunFailingTestsCount=2 verify`, the CI setting: 6 tests, 0
failures. The harness needs Docker for the Kafka container.
- On a loaded machine, the first Kafka Connect start in the JVM can exceed
the harness's fixed 30s start-up wait. CI reruns such tests, and the class
passes on its own.
- Negative checks with a temporary experiment class, since deleted:
- FTPS rejects a server certificate that the configured truststore doesn't
trust (`PKIX path building failed`);
- SFTP with strict checking and no known host rejects the server key.
- So the passing tests really do validate the server.
- `-Psourcecheck` is clean on the new module, and the full reactor build
`./mvnw clean verify -DskipTests` succeeds.
Two details for users, which could go in the docs separately:
- Without trust settings, Camel's FTPS client accepts any server
certificate. This is Camel's documented default.
- In Camel Main 4.22, `camel.ssl.trustStore` is only applied when
`camel.ssl.keyStore` is also set.
_Claude Code on behalf of Andrea Cosentino_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]