Skip to content

chore: Add Citrus integration tests for database kamelets#2919

Merged
oscerd merged 5 commits into
mainfrom
chore/tier2-database-citrus-tests
Jul 13, 2026
Merged

chore: Add Citrus integration tests for database kamelets#2919
oscerd merged 5 commits into
mainfrom
chore/tier2-database-citrus-tests

Conversation

@oscerd

@oscerd oscerd commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds container-based Citrus integration tests for 7 database kamelets using Testcontainers. All tests use Camel route YAML format (per #2873).

New tests

Kamelet Container Citrus DSL Test strategy
postgresql-source postgres Native postgresql: Init table+data via initScript:, source polls, verify via log
postgresql-sink postgres Native postgresql: Init table, timer sends JSON, sink inserts, verify via log
mongodb-source mongo Native mongodb: Pre-insert doc via Groovy, source consumes, verify via log
mongodb-sink mongo Native mongodb: Timer sends JSON, sink inserts with createCollection=true, verify via log
redis-sink redis:7 Generic container: Timer sends value with SET command, verify via log
cassandra-source cassandra:4.1 Generic container: Setup keyspace/table via Groovy, source polls CQL, verify via log
cassandra-sink cassandra:4.1 Generic container: Setup keyspace/table, timer sends JSON list, sink inserts, verify via log

Files

  • 4 new IT classes: PostgresIT.java, MongoIT.java, RedisIT.java, CassandraIT.java
  • 7 route YAML files + 7 Citrus test YAML files
  • 3 support files: init.sql, insertDocument.groovy, setupKeyspace.groovy
  • 2 application.properties (PostgreSQL, MongoDB)
  • 1 POM update: added camel-sql, camel-mongodb, camel-spring-redis, camel-cassandraql test dependencies

Test plan

  • mvn compile test-compile -pl :camel-kamelets-itest passes
  • mvn verify -pl :camel-kamelets-itest -Denable.integration.tests -Dtest=PostgresIT — PostgreSQL tests pass
  • mvn verify -pl :camel-kamelets-itest -Denable.integration.tests -Dtest=MongoIT — MongoDB tests pass
  • mvn verify -pl :camel-kamelets-itest -Denable.integration.tests -Dtest=RedisIT — Redis tests pass
  • mvn verify -pl :camel-kamelets-itest -Denable.integration.tests -Dtest=CassandraIT — Cassandra tests pass

Claude Code on behalf of Andrea Cosentino

🤖 Generated with Claude Code

Add container-based Citrus integration tests for 7 database kamelets
using Testcontainers:

- postgresql-source/sink (native Citrus postgresql: DSL with initScript)
- mongodb-source/sink (native Citrus mongodb: DSL)
- redis-sink (generic container: DSL with redis:7)
- cassandra-source/sink (generic container: DSL with cassandra:4.1)

All tests use Camel route YAML format per issue #2873. Each database
gets its own IT class (PostgresIT, MongoIT, RedisIT, CassandraIT).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
@oscerd oscerd requested a review from christophd July 10, 2026 09:09
oscerd and others added 4 commits July 10, 2026 12:24
…ng-redis

camel-sql pulls spring-jdbc 7.0.8 and camel-spring-redis pulls
spring-data-redis (with Spring 7.x beans/tx). These conflict with
Citrus HTTP servlet which requires Spring 6.x, causing
NoSuchMethodError on MetadataReaderFactory.create().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
- Add postgresql JDBC driver dependency for Citrus initScript execution
- Fix waitFor YAML syntax: use logMessage instead of log.message
  (Redis, Cassandra)
- Create MongoDB collection as capped for tailable cursor source
- Add log step in MongoDB sink route for verification

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
- Fix PostgreSQL variable names: CITRUS_TESTCONTAINERS_POSTGRESQL_DB_NAME
  (not DATABASE), SERVICE_PORT (not PORT)
- Disable Redis and Cassandra tests: the generic container: DSL
  waitFor logMessage is unreliable in CI (container log format
  varies by version and environment). These need investigation
  with the Citrus team on proper wait strategies for generic
  containers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
The Citrus verify action checks JBang log output for the expected
message. Without a log step, the sink route silently inserts data
and the verification times out.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
@oscerd oscerd merged commit 82caead into main Jul 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant