jamesnetherton opened a new pull request, #8655:
URL: https://github.com/apache/camel-quarkus/pull/8655
Fixes #4927
Fixes #7140
Fixes #7264
This commit addresses user-reported issues with AdviceWith where:
- Kafka consumers might not be fully initialized when tests run
- Tests fail on first run but succeed on subsequent runs
- Advice from one test persists and interferes with subsequent tests
Key improvements:
1. Automatic route starting after advice
- Routes that aren't advised are now automatically started after
@BeforeEach or doBeforeEach() completes
- No need to manually call startRouteDefinitions() anymore
- Ensures proper consumer initialization timing
2. Automatic advice cleanup between tests
- Route definitions are automatically restored to their original state
between test methods
- Prevents advice interference between tests
- Each test starts with a clean route state
3. New adviceRoute() helper method
- Simplifies per-test-method advice by handling lifecycle automatically
(stop, advice, start)
- Makes it easy to apply different advice in different test methods
- Example: adviceRoute("my-route", route -> {...})
4. Comprehensive test coverage
- Added Kafka integration tests validating consumer initialization
- Added test-framework tests for fast CI validation
- Tests cover: BeforeEach pattern, per-method advice, cleanup verification
5. Documentation improvements
- Expanded testing guide with AdviceWith patterns and best practices
- Created migration guide for 3.36.0 with before/after examples
- Clear guidance on when to use each approach
Tested with user-provided reproducers - both now pass successfully
--
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]