CAMEL-22524: Add HazelcastRoutePolicy integration test#22106
Conversation
Create automated IT that tests HazelcastRoutePolicy leader election using embedded Hazelcast. The test runs 3 concurrent nodes with staggered startup, each with its own HazelcastInstance and route policy, verifying that distributed lock-based leader election works correctly and all nodes eventually execute their routes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
All tested modules (72 modules)
|
...elcast/src/test/java/org/apache/camel/component/hazelcast/policy/HazelcastRoutePolicyIT.java
Outdated
Show resolved
Hide resolved
...elcast/src/test/java/org/apache/camel/component/hazelcast/policy/HazelcastRoutePolicyIT.java
Outdated
Show resolved
Hide resolved
...elcast/src/test/java/org/apache/camel/component/hazelcast/policy/HazelcastRoutePolicyIT.java
Outdated
Show resolved
Hide resolved
- Simplify CLIENTS list to List.of() instead of IntStream - Use AssertJ containsExactlyInAnyOrderElementsOf for better error messages Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…PolicyIT - Use CopyOnWriteArrayList instead of ArrayList for thread-safe results collection - Move mutable state from static fields to local test method variables - Move latch.countDown() to finally block so it always fires (even on failure) - Add proper cleanup in finally block for context and hazelcast instance - Check latch.await() return value to fail fast on timeout - Use executor.awaitTermination() to ensure clean shutdown before assertions - Use newFixedThreadPool instead of newScheduledThreadPool (no scheduling needed) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add assertj-core test dependency (fixes compilation) - Check contextLatch.await return value to verify leader election - Rename test to testLeaderElectionWithMultipleNodes - Add @timeout annotation as CI safety net Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-route-policy-it # Conflicts: # components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/policy/HazelcastRoutePolicyIT.java
|
What's the status? is it ready for another review? |
- Use AssertJ consistently instead of mixing JUnit assertTrue - Use try-with-resources for CamelContext cleanup - Use deterministic staggered startup delays - Include event count in timeout log messages Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@apupier Yes, this PR is ready for another review. The latest commit addresses your earlier feedback and adds a few more improvements:
Note: while testing locally, we noticed that Claude Code on behalf of Guillaume Nodet |
|
CI build log confirms the test ran successfully (JDK 21): Claude Code on behalf of Guillaume Nodet |
JIRA: CAMEL-22524
Summary
HazelcastRoutePolicythat tests leader election using embedded HazelcastHazelcastInstanceand route policyHazelcastRoutePolicyMainmanual test classDetails
CopyOnWriteArrayListand local variables (no static mutable state) for thread safetyCamelContextcleanup; manualfinallyforHazelcastInstance(notAutoCloseable)@Timeout(2 minutes)on the test method to prevent CI hangsassertj-coretest-scoped dependency tocamel-hazelcastTest plan
mvn test -pl components/camel-hazelcast -Dtest=HazelcastRoutePolicyIT)