davsclaus opened a new pull request, #3318:
URL: https://github.com/apache/camel-kamelets/pull/3318

   The items of #3288: the disabled Kamelet tests are enabled and check what 
the Kamelet wrote or gave, the Couchbase tests no longer need fixed host ports, 
and the HTTP servers of the tests no longer pick a port that Docker or an 
outgoing connection can take.
   
   ### Disabled tests, now enabled
   Each test now checks what the Kamelet did, not a log line. The Kamelets get 
`camel.apache.org/kamelet.verified: "true"`.
   
   | Kamelet | Test |
   |---|---|
   | `redis-sink` | `SET` stores the body under the `key` header, and the body 
stays as it was; `GET` with the Kamelet gives the value back; a Redis socket 
client then reads the key. The variable was 
`CITRUS_TESTCONTAINERS_REDIS_SERVICE_PORT`, which Citrus never sets. |
   | `mqtt5-sink`, `mqtt5-source` | `mqtt5-sink` publishes a retained message 
to EMQX 5.8.9; afterwards the body is bytes, as `application/octet-stream`. 
`mqtt5-source` gives it as bytes, with `CamelMqttTopic` and QoS 2. Because the 
message is retained, the order in which the two integrations start does not 
matter. The test no longer waits 10 seconds. |
   | `nats-sink`, `nats-source` | `nats-sink` publishes a text with a header 
`origin` every second. `nats-source` gives the payload as bytes, with 
`CamelNatsSubject` and the `origin` header, which crossed as a NATS header. 
Plain NATS keeps nothing for a late subscriber, hence the repeat. The test no 
longer waits 5 seconds. |
   | `cassandra-sink` | It inserts a row from a JSON array of values. 
Afterwards the body is an empty List, and the row is read back with the driver. 
The body of the old test was a JSON object in an array, which the Kamelet does 
not take. Its port variable was the same unset `_SERVICE_PORT`. |
   | `salesforce-create-sink`, `salesforce-update-sink`, 
`salesforce-delete-sink` | #3305 added tests with a stand-in for the Salesforce 
login and REST API (`ServicesIT#salesforce`). This PR adds the label. |
   
   ### Weak tests
   - `mongodb-sink`, `mongodb-source` and `postgresql-source` were done by 
#3276 and #3298. They read the documents back and check the body the Kamelet 
gives.
   - `azure-functions-sink`: the message now carries `Authorization`, 
`Proxy-Authorization` and `x-functions-key` headers. A Groovy script validation 
of the received request fails if `Authorization` or `Proxy-Authorization` 
reaches the function, since a header validation cannot check that a header is 
missing. The function still gets the key of the Kamelet. I checked that the 
script fails when a listed header is present. This needs 
`citrus-validation-groovy` in the test module.
   
   ### Flaky tests and fixed ports
   - **Couchbase:** the container publishes 8091, 8093 and 11210 on random host 
ports. `initCluster.groovy` renames the node to its container IP and sets the 
published host and ports as the node's `external` alternate addresses. The 
Couchbase SDK uses them when it is seeded with that host, so the routes set 
`connectionString` to the mapped data port. `couchbase-source` now checks the 
row it gives (JSON text with `__id` and `CamelCouchbaseId`) instead of a log 
line.
   - **`SlackIT` port bind** (`Failed to bind to 0.0.0.0:50072: Address already 
in use`): `SocketUtils.findAvailableTcpPort()` picks from 1024–65535, which 
includes the ephemeral range where Docker publishes container ports and 
outgoing connections take their local port. A port that was free when checked 
could be taken before Jetty bound it. The new `ServerPorts.next()` picks below 
32768 and never hands out the same port twice in a run. Every IT class uses it.
   - **`ftps-source-route-test`:** #3284 found and fixed the cause, a JVM-wide 
trust store that made `camel run` fail to download camel-ftp. No FTPS failure 
appears in the 28 failed integration runs since it merged.
   
   ### The protobuf-java pin of the Salesforce tests is gone
   The four Salesforce sink tests ran with 
`--dep=com.google.protobuf:protobuf-java:4.35.1`, the workaround for the 
`NoClassDefFoundError` of CAMEL-27260. That issue is resolved, and Camel now 
manages protobuf-java 4.36.2 (CAMEL-27300), so the pin only held protobuf back. 
Without it, all four start and pass against the stand-in. They don't need a 
real Salesforce org.
   
   ### Also fixed: `main` is red
   `google-storage-sink-storage-class-route-test` (from #3285) still expected 
no `Content-Type` after the Kamelet. Since #3307, `google-storage-sink` 
defaults to `binary`, which sets `application/octet-stream`. The test now 
expects that, and removes the header before its HTTP call, as 
`google-storage-sink-route` does (citrusframework/citrus#2081). This failed the 
integration run of `main` at 54017f9e8.
   
   ### Tests
   These were run against a local build of Camel `main` (4.24.0-SNAPSHOT, with 
CAMEL-27300 and CAMEL-27325):
   
   | Run | Result |
   |---|---|
   | `RedisIT`, `Mqtt5IT`, `NatsIT`, `CassandraIT`, `CouchbaseIT`, `SlackIT`, 
`FileIT`, `ServicesIT`, three times in a row | 32 of 32 pass each time. Rounds 
2 and 3 ran the Salesforce tests without the protobuf pin. |
   | `azure-functions-sink-route-test` | Passes. With the script set to look 
for a header that is sent (`origin`), it fails with `The function got the 
credential headers of the message: [Origin]`. |
   | `google-storage-sink-storage-class-route-test` | Passes. |
   | `./mvnw -o clean install` | `BUILD SUCCESS`; it regenerates the copies of 
the 9 Kamelets that got the label. |
   
   The other IT classes only switch to `ServerPorts.next()`; CI runs them.
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
   


-- 
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]

Reply via email to