gnodet opened a new pull request, #25148:
URL: https://github.com/apache/camel/pull/25148

   ## Summary
   
   _Claude Code on behalf of gnodet_
   
   All EventBridge IT tests share a singleton LocalStack container but use the 
same hardcoded rule name `"firstrule"` without consistent cleanup. This causes 
~40% CI failure rate across 5 tests:
   - `EventbridgeEnableRuleIT`
   - `EventbridgeListRulesIT`
   - `EventbridgeListTargetsByRuleIT`
   - `EventbridgePutRuleIT`
   - `EventbridgeRemoveTargetsIT`
   
   ### Root cause
   
   | Factor | EventBridge (flaky) | SQS/SNS/S3 (stable) |
   |--------|-------------------|---------------------|
   | Container | Singleton | Singleton or per-class |
   | Resource names | Hardcoded `"firstrule"` | Unique per test 
(`SharedNameGenerator`) |
   | Cleanup hooks | None | `@AfterEach` in base or scoped by unique names |
   | Count assertions | Global `assertEquals(1, resp.rules().size())` | Scoped 
to own resources |
   
   When tests run in an unfavorable order, a prior test's leftover 
`"firstrule"` rule (with potentially different state — DISABLED, targets 
removed, etc.) causes the next test's assertions to fail. The NPE (`resp is 
null`) happens when a prerequisite operation fails silently (exchange exception 
not checked) and the response body can't be converted to the expected type.
   
   ### Fix
   
   Add `@BeforeEach cleanUpEventBridgeRules()` in `Aws2EventbridgeBase` that:
   1. Lists all rules on the default event bus
   2. For each rule: removes its targets, then deletes the rule
   3. Wraps each step in try-catch to avoid failing the test on cleanup errors
   
   This ensures every test class starts with a clean EventBridge state, 
regardless of what the previous test left behind — matching the isolation 
patterns used by stable AWS IT tests.
   
   ## Test plan
   
   - [x] Unit tests pass (`mvn test` — 25/25)
   - [x] Source format check passes (`mvn -Psourcecheck validate`)
   - [ ] IT tests pass with Docker (CI will verify this)
   - [ ] Run CI multiple times to confirm flakiness is resolved
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to