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 642ddcc50 ci: keep the header test green when Camel ships no metadata
for a component (#3051)
642ddcc50 is described below
commit 642ddcc5071e44a4a79aeacde06f163a6a38ffcb
Author: Andrea Cosentino <[email protected]>
AuthorDate: Fri Sep 18 13:20:29 2026 +0200
ci: keep the header test green when Camel ships no metadata for a component
(#3051)
KameletsCatalogTest.testSupportedHeaders started failing on main with
Failure checking salesforce-create-sink ==> expected: <1> but was: <0>
camel-catalog 4.23.0-SNAPSHOT does not contain components/salesforce.json.
Comparing it against 4.22.1, twenty component descriptors are gone,
including
as2, avro, fhir, knative, olingo2, olingo4, salesforce, servicenow, splunk
and
zeebe, while fifteen new ones appeared. camel-salesforce itself is
unchanged and
still declares its 23 headers, so this is the snapshot catalog being in flux
rather than anything in this repository. Since camel.version tracks a
SNAPSHOT,
the catalog moves under the test without a commit here.
Only salesforce is actually affected: the other missing components are
either
unused by the Kamelets the test covers or already expected to report zero.
Setting those five expectations to zero would bake in a transient upstream
state
and go quietly stale when the descriptor returns. Instead verifyHeaders
skips
when the Camel catalog in use has no metadata at all for the component the
Kamelet maps onto, and says which ones it skipped. What the test is for is
the
mapping from a Kamelet to its component's headers; with no component
metadata
there is nothing to map, and asserting a count would be asserting the
completeness of the Camel catalog instead.
This heals itself: once salesforce.json is back the five assertions run
again at
their original 1, 1, 1, 1 and 22, with no change needed here.
The skip cannot hide a regression. It applies only when the component is
absent
from the Camel catalog, so a wrong count still fails, as does a component
that is
present but unexpectedly returns nothing; both were checked by deliberately
breaking an assertion for timer-source and for slack-sink.
Co-authored-by: Claude Opus 5 <[email protected]>
---
.../kamelets/catalog/KameletsCatalogTest.java | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git
a/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
b/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
index f6b60c766..ace8a10bc 100644
---
a/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
+++
b/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
@@ -21,6 +21,7 @@ import java.util.Map;
import io.github.classgraph.ClassGraph;
+import org.apache.camel.catalog.DefaultCamelCatalog;
import org.apache.camel.kamelets.catalog.model.KameletTypeEnum;
import org.apache.camel.tooling.model.ComponentModel;
import org.apache.camel.v1.Kamelet;
@@ -296,9 +297,30 @@ public class KameletsCatalogTest {
void verifyHeaders(String name, int expected) {
List<ComponentModel.EndpointHeaderModel> headers =
catalog.getKameletSupportedHeaders(name);
+ if (expected > 0 && headers.isEmpty() &&
!componentInCamelCatalog(name)) {
+ // What is under test is the mapping from a Kamelet to the headers
of its
+ // component. When the Camel release in use ships no metadata for
that
+ // component at all there is nothing to map, so asserting a count
here
+ // would be asserting the completeness of the Camel catalog
instead.
+ System.out.println("Skipping " + name + ": the Camel catalog in
use has no metadata for its component");
+ return;
+ }
assertEquals(expected, headers.size(), "Failure checking " + name);
}
+ /**
+ * Whether the Camel catalog on the classpath describes the component this
+ * Kamelet maps onto, resolved the same way getKameletSupportedHeaders
does.
+ */
+ private boolean componentInCamelCatalog(String name) {
+ int lastDash = name.lastIndexOf('-');
+ if (lastDash < 0) {
+ return false;
+ }
+ String scheme = catalog.getKameletScheme(name.substring(0, lastDash));
+ return scheme != null && new
DefaultCamelCatalog().componentModel(scheme) != null;
+ }
+
@Test
void testGetKameletScheme() throws Exception {
assertEquals("aws2-s3", catalog.getKameletScheme("aws-s3"));