You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/05/06 04:55:52 UTC
[PR] CAMEL-23428: Fix flaky RabbitMQProducerInvalidExchangeIT test [camel]
gnodet opened a new pull request, #22980:
URL: https://github.com/apache/camel/pull/22980
[CAMEL-23428](https://issues.apache.org/jira/browse/CAMEL-23428)
The `RabbitMQProducerInvalidExchangeIT.testProducer` test is flaky because it asserts the direct cause of `CamelExecutionException` is `ShutdownSignalException`. However, Spring AMQP may wrap the underlying `ShutdownSignalException` in an `AmqpException` depending on timing, causing intermittent failures.
**Fix:** Walk the exception cause chain to find `ShutdownSignalException` instead of asserting it is the direct cause. This handles both cases:
- Direct cause: `CamelExecutionException` → `ShutdownSignalException`
- Wrapped cause: `CamelExecutionException` → `AmqpException` → `ShutdownSignalException`
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-23428: Fix flaky RabbitMQProducerInvalidExchangeIT test [camel]
Posted by "apupier (via GitHub)" <gi...@apache.org>.
apupier commented on code in PR #22980:
URL: https://github.com/apache/camel/pull/22980#discussion_r3193715277
##########
components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerInvalidExchangeIT.java:
##########
@@ -50,7 +50,13 @@ public void testProducer() {
final CamelExecutionException exception = Assertions.assertThrows(CamelExecutionException.class,
() -> template.sendBody("direct:start", "Hello World"));
- Assertions.assertInstanceOf(ShutdownSignalException.class, exception.getCause());
+ // Spring AMQP may wrap ShutdownSignalException in AmqpException depending on timing
+ Throwable cause = exception.getCause();
+ while (cause != null && !(cause instanceof ShutdownSignalException)) {
+ cause = cause.getCause();
+ }
+ Assertions.assertInstanceOf(ShutdownSignalException.class, cause,
+ "Expected ShutdownSignalException in cause chain, but got: " + exception.getCause());
Review Comment:
I think we could use https://javadoc.io/doc/org.assertj/assertj-core/3.27.7/org/assertj/core/api/AbstractThrowableAssert.html#hasCauseInstanceOf(java.lang.Class)
it will allow to have shorter code and also a better error message with the full stack trace.
Especially given that it sounds like a stab in the dark that the AMQPEXception is wrapping the shutdownexception. At least, if i tis not the case, i twill help to investigate more.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-23428: Fix flaky RabbitMQProducerInvalidExchangeIT test [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #22980:
URL: https://github.com/apache/camel/pull/22980#issuecomment-4385310900
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `components/camel-spring-parent/camel-spring-rabbitmq`
<details><summary>All tested modules (8 modules)</summary>
- Camel :: JBang :: MCP
- Camel :: JBang :: Plugin :: Route Parser
- Camel :: JBang :: Plugin :: TUI
- Camel :: JBang :: Plugin :: Validate
- Camel :: Launcher :: Container
- Camel :: Spring RabbitMQ
- Camel :: YAML DSL :: Validator
- Camel :: YAML DSL :: Validator Maven Plugin
</details>
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/25417244043)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-23428: Fix flaky RabbitMQProducerInvalidExchangeIT test [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #22980:
URL: https://github.com/apache/camel/pull/22980
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-23428: Fix flaky RabbitMQProducerInvalidExchangeIT test [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #22980:
URL: https://github.com/apache/camel/pull/22980#issuecomment-4385209708
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
* You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-23428: Fix flaky RabbitMQProducerInvalidExchangeIT test [camel]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #22980:
URL: https://github.com/apache/camel/pull/22980#discussion_r3194031159
##########
components/camel-spring-parent/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerInvalidExchangeIT.java:
##########
@@ -50,7 +50,13 @@ public void testProducer() {
final CamelExecutionException exception = Assertions.assertThrows(CamelExecutionException.class,
() -> template.sendBody("direct:start", "Hello World"));
- Assertions.assertInstanceOf(ShutdownSignalException.class, exception.getCause());
+ // Spring AMQP may wrap ShutdownSignalException in AmqpException depending on timing
+ Throwable cause = exception.getCause();
+ while (cause != null && !(cause instanceof ShutdownSignalException)) {
+ cause = cause.getCause();
+ }
+ Assertions.assertInstanceOf(ShutdownSignalException.class, cause,
+ "Expected ShutdownSignalException in cause chain, but got: " + exception.getCause());
Review Comment:
Good point, thanks! Switched to `assertThat(exception).hasRootCauseInstanceOf(ShutdownSignalException.class)` — uses `hasRootCauseInstanceOf` rather than `hasCauseInstanceOf` since the `ShutdownSignalException` is the deepest cause in both the direct and wrapped scenarios. This also gives the full stack trace on failure as you suggested.
_Claude Code on behalf of Guillaume Nodet_
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org