citrusframework / citrusframework/citrus
Flaky test: CamelRouteIT.camelRoute01IT fails with null message payload in CI
- Dominant language
- Java
- Stars
- 485
- Forks
- 155
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 7
Description
## Description
`CamelRouteIT.camelRoute01IT` in `endpoints/citrus-camel` is flaky in GitHub CI. The test intermittently fails with a validation error because the received message body is `null` instead of the expected XML payload.
## Steps to Reproduce
1. Run the CI workflow — the test fails intermittently (not every run)
2. Locally reproducible under resource pressure: `./mvnw verify -pl endpoints/citrus-camel`
## Expected Behavior
The message sent to `direct:in-route` should be routed by the Camel route to `direct:default-route` and received by the Citrus `defaultRouteEndpoint` within the configured 1000ms timeout.
## Actual Behavior
The receive action at `CamelRouteIT.java:39` gets a `null` payload instead of `Citrus rocks!`.
```
Validation failed - message payload not equal at position 1
expected 'Citrus roc', but was 'null'
```
## Analysis
The test sends a message with `fork(true)` (async) on `inRouteEndpoint` (`direct:in-route`) and then immediately tries to receive on `defaultRouteEndpoint` (`direct:default-route`, sync endpoint, 1000ms timeout). The Camel route forwards the message to `direct:default-route` with `pattern="InOut"`.
This is a race condition: if the Camel route delivers the message to `direct:default-route` before the Citrus receive consumer is registered, the message is lost. In CI environments with constrained resources, the timing window is narrower, making the failure more likely.
## Additional Context
- Test class: `endpoints/citrus-camel/src/test/java/org/citrusframework/camel/integration/CamelRouteIT.java`
- Spring context: `endpoints/citrus-camel/src/test/resources/citrus-context.xml`
- The `defaultRouteEndpoint` is configured as a `citrus-camel:sync-endpoint` with `timeout="1000"`
- The same pattern is used in `camelRoute02IT` and could also be affected
Contributor guide
Research direction
Start with endpoints/citrus-camel/src/test/java/org/citrusframework/camel/integration/CamelRouteIT.java, especially line 39 and the analogous camelRoute02IT, then inspect the endpoint definitions in endpoints/citrus-camel/src/test/resources/citrus-context.xml. Run ./mvnw verify -pl endpoints/citrus-camel under resource pressure and verify both tests reliably receive the expected XML payload without null-message failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100