This is an automated email from the ASF dual-hosted git repository.
oscerd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push:
new b3062d910 ci: the FTPS tests downloaded their dependencies with a
trust store holding only the test certificate (#3284)
b3062d910 is described below
commit b3062d91016eb7078e370e6673ec678a7ee54ff7
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Nov 20 10:20:55 2026 +0100
ci: the FTPS tests downloaded their dependencies with a trust store holding
only the test certificate (#3284)
* ci: the FTPS test server speaks TLS 1.2, as the FTPS tests of camel-ftp do
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* ci: the ftps-source test shows the log of the integration when the file
is not read
TLS 1.2 on the test server did not stop the failures, so it is taken back.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* ci: the FTPS test trust store also holds the certificates the JDK trusts
javax.net.ssl.trustStore applies to the whole JVM of the integration, so
camel run downloaded its dependencies with a trust store holding only the
test certificate. When camel-ftp was not cached yet, such as after a new
SNAPSHOT, the download failed with PKIX path building failed, the route
of ftps-source could not be created, and the test failed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../src/test/resources/ftp/ftpServer.groovy | 15 +++++++++++++--
.../test/resources/ftp/ftps-source-route.citrus.it.yaml | 9 +++++++++
.../src/test/resources/ftp/ftps-source-route.yaml | 3 +++
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/tests/camel-kamelets-itest/src/test/resources/ftp/ftpServer.groovy
b/tests/camel-kamelets-itest/src/test/resources/ftp/ftpServer.groovy
index 79db2b70e..101452cbd 100644
--- a/tests/camel-kamelets-itest/src/test/resources/ftp/ftpServer.groovy
+++ b/tests/camel-kamelets-itest/src/test/resources/ftp/ftpServer.groovy
@@ -19,7 +19,8 @@
// has characters that have a meaning in an endpoint address, and whose home
directory is a new temporary
// directory (variable ftp.home). With the variable ftp.tls set to true, the
server speaks FTPS (explicit
// TLS, on the control and the data connections), with a certificate for
localhost made for the test;
-// ftp.truststore is then a trust store with this certificate, for the
integration.
+// ftp.truststore is then a trust store with this certificate and the
certificates the JDK trusts, for the
+// integration.
import java.nio.file.Files
import java.security.KeyStore
@@ -51,11 +52,21 @@ if (context.getVariables().containsKey('ftp.tls') &&
Boolean.parseBoolean(contex
throw new IllegalStateException('keytool failed with exit code ' +
process.exitValue())
}
- // the trust store of the integration holds only the certificate of the
server
+ // the trust store of the integration holds the certificate of the server
AND the certificates the JDK trusts:
+ // javax.net.ssl.trustStore applies to the whole JVM of the integration,
so camel run downloads its
+ // dependencies (such as a new camel-ftp SNAPSHOT from
https://repository.apache.org) with it too, and a trust
+ // store with only the test certificate fails those downloads with "PKIX
path building failed"
def keys = KeyStore.getInstance('PKCS12')
keyStore.toFile().withInputStream { keys.load(it,
'changeit'.toCharArray()) }
def trusted = KeyStore.getInstance('PKCS12')
trusted.load(null, null)
+ def jdkTrusted = KeyStore.getInstance(KeyStore.getDefaultType())
+ new File(System.getProperty('java.home'),
'lib/security/cacerts').withInputStream { jdkTrusted.load(it, null) }
+ for (alias in jdkTrusted.aliases().toList()) {
+ if (jdkTrusted.isCertificateEntry(alias)) {
+ trusted.setCertificateEntry(alias,
jdkTrusted.getCertificate(alias))
+ }
+ }
trusted.setCertificateEntry('ftps', keys.getCertificate('ftps'))
trustStore.toFile().withOutputStream { trusted.store(it,
'changeit'.toCharArray()) }
context.setVariable('ftp.truststore', trustStore.toString())
diff --git
a/tests/camel-kamelets-itest/src/test/resources/ftp/ftps-source-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/ftp/ftps-source-route.citrus.it.yaml
index 1faed2686..55cbe97a5 100644
---
a/tests/camel-kamelets-itest/src/test/resources/ftp/ftps-source-route.citrus.it.yaml
+++
b/tests/camel-kamelets-itest/src/test/resources/ftp/ftps-source-route.citrus.it.yaml
@@ -49,6 +49,15 @@ actions:
- name: "javax.net.ssl.trustStoreType"
value: "PKCS12"
+ # Wait until the source has read the file: when it does not, this step fails
and shows the log of the
+ # integration, such as an error of the FTPS connection
+ - camel:
+ cli:
+ verify:
+ integration: "ftps-source-route"
+ logMessage: "ftps-source read order 1.csv"
+ maxAttempts: 60
+
# The source gives the content of the file as a stream, with its name and
size
- http:
server: "fileHttpServer"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/ftp/ftps-source-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/ftp/ftps-source-route.yaml
index af365571b..45af2c085 100644
--- a/tests/camel-kamelets-itest/src/test/resources/ftp/ftps-source-route.yaml
+++ b/tests/camel-kamelets-itest/src/test/resources/ftp/ftps-source-route.yaml
@@ -26,6 +26,9 @@
password: 's3cr&t+pw'
directoryName: 'orders'
steps:
+ # a line for the test to wait for, so that a failure shows the log of
the integration
+ - log:
+ message: "ftps-source read ${header.CamelFileName}"
# what the Kamelet gives: the Java type of the body and the
Content-Type
- setHeader:
name: X-Body-Type